mail.send

Sends mail using configured mail settings.

Type: object

Type: array
No Additional Items

Tuple Validation

Parameter 1: message

message

Type: object
No Additional Properties

Subject

Type: string

Text

Type: string

Formatted 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.

Type: string
Type: null

To

Type: array of string

Email recipients. Defaults to all local administrators.

No Additional Items
Each item of this array must be:
Type: string

Cc

Type: array of string

Email CC recipients, if any.

No Additional Items
Each item of this array must be:
Type: string

Interval


In seconds.

Type: integer
Type: null

Channel


Defaults to "truenas".

Type: string
Type: null

Timeout

Type: integer Default: 300

Time limit for connecting to the SMTP server in seconds.

Attachments

Type: boolean Default: false

If 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)

.. code-block:: json

[
  {
    "headers": [
      {
        "name": "Content-Transfer-Encoding",
        "value": "base64"
      },
      {
        "name": "Content-Type",
        "value": "application/octet-stream",
        "params": {
          "name": "test.txt"
        }
      }
    ],
    "content": "dGVzdAo="
  }
]

Queue

Type: boolean Default: true

Queue the message to be sent later if it fails to send.

Extra Headers

Type: object

Any additional headers to include in the email message.

Parameter 2: config

config

Type: object
No Additional Properties

Fromemail

Type: string

The sending address that the mail server will use for sending emails.

Fromname

Type: string

Outgoingserver

Type: string

Hostname or IP address of the SMTP server used for sending emails.

Port

Type: integer

Security

Type: enum (of string)

Type of encryption.

Must be one of:
  • "PLAIN"
  • "SSL"
  • "TLS"

Smtp

Type: boolean

Whether SMTP authentication is enabled and user, pass are required.

User


SMTP username.

Type: string
Type: null

Pass


SMTP password.

Type: string
Type: null

Oauth


MailEntryOAuth

Type: object
No Additional Properties

Provider

Type: string

An email provider, e.g. "gmail", "outlook".

Client Id

Type: string

Client Secret

Type: string

Refresh Token

Type: string

EmptyDict

Type: object
Type: null

Result

Type: boolean

The message was sent successfully.



Required roles: MAIL_WRITE