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

Type: object

##

Type: array
No Additional Items

#### Tuple Validation

##### Parameter 1: message

#### message

Type: object

Email message content and configuration.

No Additional Properties

##

#### Subject

Type: string

Subject line for the email message.

##

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

## Any of

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.

## Any of

Type: integer
Type: null

##

#### Channel

Defaults to "truenas".

## Any of

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)

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: 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

Optional mail configuration overrides for this message.

No Additional Properties

##

#### Fromemail

Type: string

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

##

#### Fromname

Type: string

Display name that will appear as the sender name in outgoing emails.

##

#### Outgoingserver

Type: string

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

##

#### Port

Type: integer

TCP port number for the SMTP server connection.

##

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

## Any of

Type: string
Type: null

##

#### Pass

SMTP password.

## Any of

Type: string
Type: null

##

#### Oauth

OAuth configuration for email providers that support it or `null` for basic authentication.

## Any of

#### MailEntryOAuth

Type: object
No Additional Properties

##

#### Provider

Type: string

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

##

#### Client Id

Type: string

OAuth client ID provided by the email provider.

##

#### Client Secret

Type: string

OAuth client secret provided by the email provider.

##

#### Refresh Token

Type: string

OAuth refresh token used to obtain new access tokens for email authentication.

#### EmptyDict

Type: object
Type: null

##

#### Result

Type: boolean

The message was sent successfully.

Required roles: MAIL_WRITE