Skip to main content

emailAddress()

Last updated 11/09/2024

Example One

The following code executes a mail merge called SubmissionReceived to john@example.co.

JavaScript
Using a single parameter as the context
const mailResult = five.executeAction('SubmissionReceived', five.emailAddress('john@example.co', 'John Citizen'));

Example Two

The following code is sending the same email as example one, but carbon copying and blind carbon copying other email addresses.

JavaScript
Using a more complex mail merge context, allowing to send to multiple addresses and sending Cc and Bcc emails
const mailMergeContext = {};
mailMergeContext['SMTPAddresses'] = [five.emailAddress('john@example.co', 'John Citizen')];
mailMergeContext['SMTPCcAddresses'] = [five.emailAddress('kirk@example.co', 'Finance'), five.emailAddress('belinda@example.co', 'Orders')];
mailMergeContext['SMTPBccAddresses'] = [five.emailAddress('management@example.co', 'Management')];
const mailResult = five.executeAction('SubmissionReceived', mailMergeContext);