sendMail(
subject: "Hello world!",
to: "Mr. Foobar <foo@bar.com>",
body: {{{
<h1>Hello {$receiver}<h1>
<p>...</p>
}}},
attachments: [
binary(...),
{
"cid": "attachment1",
"data": binary(...)
}
],
cc: ["info@foo.com", "bar@foo.com"],
bcc: "hidden@foobar.com"
)
Sends an e-mail with the specified parameters. To be able to use this function, e-mail dispatch must be activated in the application.
| Email name | Type | Type Description | Mandatory | Default |
|---|---|---|---|---|
subject |
Character string | The subject of the e-mail | Yes | |
to |
Character string/list of character strings | The recipient(s) of the email. For reasons of data protection, only one recipient should ever be specified for a mass e-mail and the function should be called up individually for all recipients. | Yes | |
body |
Character string/HTML/binary data | The content of the email. | yes | |
attachments |
List of binary data or attachment descriptions (see below) | Additional content that is sent in the email. | no | [] |
cc |
Character string/list of character strings | List of recipients who should receive a copy of the e-mail | no | [] |
bcc |
String/list of strings | List of recipients who should receive a copy of the e-mail without the other recipients seeing their e-mail addresses. | no | [] |
Type: Truth value
Whether the email was sent successfully.
Either a binary value can be passed directly as an attachment or a JSON object that describes the attachment in more detail:
{
"filename": "policies.pdf",
"disposition": "attachment",
"description": "Some attachment.",
"cid": "id1",
"headers": {
"key": "value"
},
"data": $binaryData
}
The attributes of the attachment description have the following meaning:
"filename": The file name for the attachment as it should be displayed in the recipient's email program. When the attachment is saved, this file name is suggested to the user."disposition": "inline" or "attachment". If "inline" is specified, the attachment is hidden from the recipient. This is useful if, for example, an image is sent that is embedded in the content of the e-mail. See "cid"."description"An optional description of the attachment."cid"The content ID of the attachment. This ID can be used, for example, to embed an attached image in an HTML email. If the value "id1" has been specified as "cid", this attachment can be referenced from the HTML content of the email via <img src="cid:id1"/>, for example."headers"Further optional header information that is set on the attachment."data"The actual content of the attachment. Like the content of the e-mail, the content can be either a character string, HTML or binary data.