0
votes

I would like to send an email to multiple bcc recipents using gmailapp in google apps script.

The following didn't work. I tested it. it seems that only the second recipient bcc2 will get the email. I couldn't find the answer in Google's documents (https://developers.google.com/apps-script/reference/mail/mail-app)

var bcc = "[email protected]";

var bcc2 = "[email protected]";

GmailApp.sendEmail("",Email_Title, "", {'bcc':bcc, 'bcc':bcc2, htmlBody: Msg });


I can get around this by using a for loop

var bcc = ["[email protected]", "[email protected]"];

for (var i = 0; i < bcc.length; i++){}

But this is not ideal to me, as I would find multiple sent email in the sent box, rather than one sent email, with multiple bcc recipients

1

1 Answers

4
votes

If you look at the documentation in the link you provided, it states that it needs to be a string, comma-separated list of email addresses. Therefore your code should look like this:

var bcc1and2 = "[email protected],[email protected]";

GmailApp.sendEmail("",Email_Title, "", {'bcc':bcc1and2, htmlBody: Msg });