Mastering Development

Google App Script: Create a list manually

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 = " "
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="">Send Mail example</a>.</p>';
var advancedArgs = {htmlBody:bodyHTML1+bodyHTML2+bodyHTML3 , replyTo:email};
MailApp.sendEmail(recipient, "Contact Us Form", body, advancedArgs);
MailApp.sendEmail(recipient, "Error - Contact Us Form", e.message);

Leave a Reply

Your email address will not be published. Required fields are marked *