I have a simple script that executes once form submit. It is a simple test script applied html for email.
function sendEmail(e) {
//response
//getRespondentEmail()
var html = HtmlService.createTemplateFromFile("email.html");
var htmlText = html.getCode();
var emailTo = e.response.getRespondentEmail();
var subject = "Thanks for participating";
var textBody = "This email requries HTML support, please maek sure you open with a client taht support.";
var options = { htmlBody: htmlText };
if(emailTo !== undefined){
GmailApp.sendEmail(emailTo,subject,textBody,options);
//(recipient, subject, body, options)
}
}
But it always noticed TypeError: Cannot read property 'response' of undefined.
TypeError: Cannot read property 'response' of undefined (line 8, file "Code")
either the respose from my host email said 'Failed to send email: no recipient'
I do not know why it does not work, but I see someone successfully applied through above google app script.