Google forms scripts to send email -
i have created script go along camp signup form. when student signs up, need email sent both parent , leader. have general script format correct each 1 works when (the script bound spreadsheet, not form). if have both functions in code.gs file or in separate file, neither of them work. how supposed run more 1 function attached form submission?
here code 2 emails sent:
here code 2 emails sent (if add both these, doesn't work): function emailresponsetoparent(e) { var studentname = e.values[1]; var parentemail = e.values[3]; var tripname = e.values[6] var subject = "your young life " + tripname + " registration has been submitted." var message = "we have received " + studentname + "'s signup registration " + tripname + ". more words here...."; mailapp.sendemail(parentemail, subject, message);
}
function emailresponsetoleader(e) { var studentname = e.values[1]; var leaderemail = "meg@me.com"; var tripname = e.values[6] var subject = "a young life student of yours has signed " + tripname + " camp." var message = studentname + "has registered " + tripname + ". more words here...."; mailapp.sendemail(leaderemail, subject, message);
}
a separate question (less important) how create script later follow email goes out based on date (e.g. week before camp starts).
i don't know if of use can create list of recipients receive same email (just email can specify multiple recipients). replace mailapp following:
var emails = parentemail + "," + leaderemail;
mailapp.sendemail(emails, subject, message);
it has worked me (but both recipients wanted same info).
i couldn't script access form data until came across method used in script (e.values[ ] ) worked treat - that!
Comments
Post a Comment