I’m trying to automate my emails using mail merge.
the following code was found in the documentation:
mailMergeContext['SMTPCcAddresses'] = [five.emailAddress('kirk@example.co', 'Finance'), five.emailAddress('belinda@example.co', 'Orders')];
I have a single text SendTo field on my email form which looks like this:
John Doe <jdoe@domain.com>; joeblow@domain.com; ...
So the addresss can be verbose or terse.
I have a helper function that converts my email text into an array that would look like this:
[five.emailAddress('jdoe@domain.com', 'John Doe'), five.emailAddress('joeblow@domain.com')]
So the question is, canI just pop that array into the statement that loads the mailMergeContext?
const mailContext = {
SMTPToEmail: fiveSendTo,
SMTPCcEmail: fiveCcTo,
SMTPBccEmail: fiveBccTo,
SMTPSubject: subject,
SMTPBody: body,
SMTPAttachments: attachments
};
Where fiveSendTo, fiveCcTo and fiveBccTo are arrays that resemble the above?
I don’t exactly know what the five.emailAddress object looks like.