SMTP module written using the Go language.
Install the module by running the following command in the @thingsdb scope:
new_module("smtp", "github.com/thingsdb/module-go-smtp");Optionally, you can choose a specific version by adding a @ followed with the release tag. For example: @v0.1.0.
The smtp module requires configuration with the following properties:
| Property | Type | Description |
|---|---|---|
| host | str (required) | SMTP host, eg 'myhost.local:587' |
| auth | [str, str] | Optional authentication. [Username, Password]. |
Example configuration:
set_module_conf("smtp", {
host: "myhost.local:587",
auth: ["myuser", "mypassword"],
});| Name | Description |
|---|---|
| send_mail | Send an email. |
Syntax: send_mail(to, mail)
mail: (thing) Mail to send.
// Only subject is required
mail = {
bcc: ['[email protected]'],
cc: ['[email protected]'],
from: '[email protected]',
from_name: 'Bob',
html: '<html>Html Body</html>',
plain: 'plain text body',
reply_to: '[email protected]',
subject: 'my subject',
};
to = ['[email protected]'];
// Send the email
smtp.send_mail(to, mail).else(|err| {
err; // some error has occurred
})