在Google Apps脚本MailApp.sendEmail中使用多个抄送和/或密件抄送
问题描述:
当我运行程序时,只有boss1@gmail.com
被密件抄送.
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"}
);
答
要求:
发送具有多个抄送/密件抄送地址的电子邮件.
Requirement:
Send emails with multiple cc / bcc addresses.
从sendEmail
文档的高级参数"部分中:
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.
MailApp.sendEmail(
EPEmail,
"Internship Opportunity at "+OP,
emailText,{
cc:Manager1+','+EPManager2+','+EPManager3,
bcc:Boss+','+"boss1@gmail.com"}
);