I am trying to create a list of email recipients instead of just one recipient. Then send the email to all these recipients through app inventor. How do I do it? The code below send to only one recipient
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);
}
}
Just comma-separate them
var recipient = "[email protected], [email protected], [email protected]";
If you have them in array it might be like
var emails = ["[email protected]", "[email protected]", "[email protected]"];
var recipient = emails.join(',');