Recipient
Defining the recipient is as simple as declaring the recipient
variable that must be a valid email address.
js
{// Other variables"recipient": "foo@example.org"}
Multiple recipients
If you need to send the same email to multiple recipients you can do it as well by using the recipients
key instead of recipient
:
js
{// Other variables"recipients": ["foo@example.org","bar@example.org"]}
You can even define specific variables, cc, bcc and more for each single recipient.
Per-recipient data will be merged with global data, take an example to this snippet:
js
{// Other variables"recipients": [{"recipient": "foo@example.org","variables": {"name": "Foo"}},{"recipient": "foo@example.org","cc": "bar2@example.org"}],"variables": {"companyName": "MailCarrier","name": "Default"},"cc": "global+cc@example.org",}
What will happen here:
- The first email will be sent to
foo@example.org
withname: Foo
andcc: global+cc@example.org
; - The second email will be sent to
bar@example.org
withname: Default
andcc: bar2@example.org
.
Both emails will have access to the companyName: MailCarrier
variable. The same applies to attachments and remote attachments.