Use of multiple cc and/or bcc in google apps scrip

2020-05-09 14:40发布

When I run the program, only boss1@gmail.com gets bcc'ed.

I've debugged the program and each variable is logged correctly.

MailApp.sendEmail(
    EPEmail, 
    "Internship Opportunity at "+OP,
    emailText,{
        cc:Manager1,
        cc:EPManager2,
        cc:EPManager3,
        bcc:Boss,
        bcc:"boss1@gmail.com"}
);

1条回答
Ridiculous、
2楼-- · 2020-05-09 15:30

Requirement:

Send emails with multiple cc / bcc addresses.


Solution:

From the "Advanced parameters" section of sendEmail documentation:

a comma-separated list of email addresses to CC

This means we can concatenate the variables and separate them with commas using the + operator to achieve your goal.


Example:

MailApp.sendEmail(
    EPEmail, 
    "Internship Opportunity at "+OP,
    emailText,{
        cc:Manager1+','+EPManager2+','+EPManager3,
        bcc:Boss+','+"boss1@gmail.com"}
);

Reference:

查看更多
登录 后发表回答