Google 应用脚本:手动创建列表

Google App Script: Create a list manually

我正在尝试创建一个电子邮件收件人列表,而不是一个收件人。然后通过应用程序发明家将电子邮件发送给所有这些收件人。我该怎么做?下面的代码只发送给一个收件人

function contactUsMailer(e) {
try {
var recipient = "example@gmail.com "
var timestamp = e.values[0];
var name = e.values[1];
var email = e.values[2];
var message = e.values[3];
var body = name+' <'+email+'> sent the following message: '+message;
var bodyHTML1 = '<p>'+name+' <a href="mailto:'+email+'">'+email+'</a> sent the following message: </p>';
var bodyHTML2 = '<blockquote>'+message+'</blockquote>';
var bodyHTML3 = '<p>Sent by the Pura Vida Apps <a href="http://www.puravidaapps.com/sendmailGS.php">Send Mail example</a>.</p>';
var advancedArgs = {htmlBody:bodyHTML1+bodyHTML2+bodyHTML3 , replyTo:email};
MailApp.sendEmail(recipient, "Contact Us Form", body, advancedArgs);
} 
catch(e){
MailApp.sendEmail(recipient, "Error - Contact Us Form", e.message);
  }
}  

用逗号分隔

var recipient = "example@gmail.com, example2@gmail.com, example3@gmail.com";

如果你把它们放在数组中,它可能就像

var emails = ["example@gmail.com", "example2@gmail.com", "example3@gmail.com"];
var recipient = emails.join(',');