Email

Table of contents

The Email API provides functionality for sending email messages through SMTP servers in Memento Database scripts.

Global Functions

email()

Returns the system Email object that provides email-related functionality.

Returns

  • Email - The system Email object

Example

let emailObj = email();
log("Email object created");

Email Object

The Email object provides methods for sending email messages through configured SMTP servers.

send(cfg, to, subject, message)

Sends an email message using the specified SMTP configuration.

Parameters

Parameter Type Description
cfg EmailConfig or defaultEmailConfig() SMTP configuration object containing server details, or a call to defaultEmailConfig() to use the global email settings from the application
to String Recipient email address
subject String Email subject line
message String Email body content

Returns

  • void

Example

Using explicit configuration:

// Create SMTP configuration
var cfg = {
    "host": "smtp.example.com",
    "port": 25,
    "user": "username",
    "pass": "password",
    "from": "username@example.com"
};
// Send email
email().send(cfg, "to@email.com", "Test Subject", "Hello from Memento!");
log("Email sent successfully");

Using default application settings:

// Use default email configuration defined in the app settings
var cfg = defaultEmailConfig();
// Send email
email().send(cfg, "to@email.com", "Test Subject", "Hello using default config!");
log("Email sent successfully");