I am trying to automated emails. I have a query in google sheets that displays me all cases where an email has to be sent. The for loop collects the corresponding customer name,
You need to use the sendEmail(recipient, subject, body, options)
method with the BCC and CC in the options
parameter.
As per the documentation:
sendEmail(recipient, subject, body, options)
Sends an email message with optional arguments.
And in the Advanced parameters section:
bcc String
: a comma-separated list of email addresses to BCC
cc String
: a comma-separated list of email addresses to CC
MailApp.sendEmail({to: currentEmEmail,
subject: subjectLine,
htmlBody: messageBody,
cc: "p........@......",
attachments: [file1, file2]});
Should be:
MailApp.sendEmail(currentEmEmail, subjectLine, messageBody, {
cc: "p........@......",
name: 'Automatic Emailer Script',
attachments: [file1, file2]
});
I hope this is helpful to you!