mail.send¶
Sends mail using configured mail settings.
This method is a job.
This job CAN be used with file upload. See Uploading a File.
No Additional Items
Tuple Validation
Parameter 1: message
message
Type: objectEmail message content and configuration.
No Additional PropertiesSubject
Type: stringSubject line for the email message.
Text
Type: stringFormatted to HTML using Markdown and rendered using default email template.
Html
Custom HTML (overrides text). If null, no HTML MIME part will be added to the email.
To
Type: array of stringEmail recipients. Defaults to all local administrators.
No Additional ItemsEach item of this array must be:
Cc
Type: array of stringEmail CC recipients, if any.
No Additional ItemsEach item of this array must be:
Interval
In seconds.
Channel
Defaults to "truenas".
Timeout
Type: integer Default: 300Time limit for connecting to the SMTP server in seconds.
Attachments
Type: boolean Default: falseIf set to true, an array compromised of the following object is required via HTTP upload:
headers (array)
- name (string)
- value (string)
- params (object)
content (string)
Example:
[
{
"headers": [
{
"name": "Content-Transfer-Encoding",
"value": "base64"
},
{
"name": "Content-Type",
"value": "application/octet-stream",
"params": {
"name": "test.txt"
}
}
],
"content": "dGVzdAo="
}
]
Queue
Type: boolean Default: trueQueue the message to be sent later if it fails to send.
Extra Headers
Type: objectAny additional headers to include in the email message.
Parameter 2: config
config
Type: objectOptional mail configuration overrides for this message.
No Additional PropertiesFromemail
Type: stringThe sending address that the mail server will use for sending emails.
Fromname
Type: stringDisplay name that will appear as the sender name in outgoing emails.
Outgoingserver
Type: stringHostname or IP address of the SMTP server used for sending emails.
Port
Type: integerTCP port number for the SMTP server connection.
Security
Type: enum (of string)Type of encryption.
Must be one of:
- "PLAIN"
- "SSL"
- "TLS"
Smtp
Type: booleanWhether SMTP authentication is enabled and user, pass are required.
User
SMTP username.
Pass
SMTP password.
Oauth
OAuth configuration for email providers that support it or null for basic authentication.
MailEntryOAuth
Type: objectNo Additional Properties
Provider
Type: stringAn email provider, e.g. "gmail", "outlook".
Client Id
Type: stringOAuth client ID provided by the email provider.
Client Secret
Type: stringOAuth client secret provided by the email provider.
Refresh Token
Type: stringOAuth refresh token used to obtain new access tokens for email authentication.
EmptyDict
Type: objectResult
Type: booleanThe message was sent successfully.
Required roles: MAIL_WRITE