$mail.config
This method configures the settings of the SMTP server
that will be used for sending email messages via the $mail.sendMessage
method.
caution
Depending on how you call the method, it can set the server configuration:
- for ECMAScript 5 and ECMAScript 6 at the same time;
- for one of these runtimes only.
Syntax
The method accepts six arguments:
Argument | Type | Description |
---|---|---|
smtpHost | String | SMTP server host. |
smtpPort | Number | SMTP server port. |
user | String | SMTP server user. |
password | String | SMTP server password. |
from | String | Email sender. |
hiddenCopy | String or string array | Email hidden copy recipient or list of recipients. This argument is optional. |
$mail.config(
"smtp.just-ai.com", // Host
2525, // Port
"user@just-ai.com", // User
$secrets.get("smtpPassword"), // Password
"bot@just-ai.com", // Sender
"admin@just-ai.com" // Hidden copy recipient
// ["admin@just-ai.com", "support@just-ai.com"] // List of hidden copy recipients
);
tip
The settings will be used for all subsequent calls to the
$mail.sendMessage
method,
until overridden by another $mail.config
call.How method works in ES5 and ES6
- If you call
$mail.config
in theinit
tag, it sets the same configuration for all runtimes: ECMAScript 5 and ECMAScript 6. - If you call
$mail.config
in thescript
tag, it sets the configuration only for ECMAScript 5. If you call it inscriptEs6
, it sets the configuration only for ECMAScript 6.
The $mail.sendMessage
method uses the SMTP server configuration from the runtime where it is called.