Skip to content

Mail

Sends a mail.

Presents UI for sending a mail.

toRecipients

Recipients of the mail.

Array of recipients to send the mail to. Elements in the array should be e-mail addresses. You will have a chance to modify this before the mail is sent.

toRecipients: [string]

ccRecipients

Recipients to set CC on the mail.

Array of recipients to set as CC on the mail. Elements in the array should be e-mail addresses. You will have a chance to modify this before the mail is sent.

ccRecipients: [string]

bccRecipients

Recipients to set BCC on the mail.

Array of recipients to set as BCC on the mail. Elements in the array should be e-mail addresses. You will have a chance to modify this before the mail is sent.

bccRecipients: [string]

subject

Subject of the mail.

Subject of the mail to send. You will have a chance to modify this before the mail is sent.

subject: string

body

Body of the mail.

Body of the mail to send. You will have a chance to modify this before the mail is sent.

body: string

isBodyHTML

Whether body is HTML.

Set to true if the body of the mail is HTML. Defaults to false.

isBodyHTML: bool

preferredSendingEmailAddress

Preferred email address to use in the from field.

Sets the preferred email addressed to use when sending the mail. If no account with the preferred email address is set up, the default email address is used.

preferredSendingEmailAddress: string

-new Mail

Constructs a mail.

new Mail()

-send

Send the mail.

send(): Promise

Presents a screen from which the mail can be sent. The mail will not be sent until you have confirmed it from the presented screen.

Return value

Promise
Promise that is fulfilled when the mail have been sent or saved.


-addImageAttachment

Adds an image attachment to the mail.

addImageAttachment(image: Image)

Parameters

image
Image
Image to add to the mail.


-addFileAttachment

Adds a file attachment to the mail.

addFileAttachment(filePath: string)

Parameters

filePath
string
Path of file to add to the mail.


-addDataAttachment

Adds a data attachment to the mail.

addDataAttachment(data: Data, mimeType: string, filename: string)

When adding a data attachment to the mail, you are responsible for providing a valid MIME type and filename. It is advised to use addImageAttachment and addFileAttachment whenever possible.

Parameters

data
Data
Data representation of file to add to the mail.

mimeType
string
MIME type of file represented by the data.

filename
string
Name of the file represented by the data.