Google App脚本:手动创建列表

问题描述 投票:0回答:1

我正在尝试创建电子邮件收件人列表,而不只是一个收件人。然后通过App Inventor将电子邮件发送给所有这些收件人。我该怎么做?以下代码仅发送给一个收件人

function contactUsMailer(e) {
try {
var recipient = "[email protected] "
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);
  }
}  
google-apps-script google-sheets google-form app-inventor
1个回答
0
投票

用逗号分隔

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

如果您将它们放在数组中,可能会像

var emails = ["[email protected]", "[email protected]", "[email protected]"];
var recipient = emails.join(',');
© www.soinside.com 2019 - 2024. All rights reserved.