Skip to content

Instantly share code, notes, and snippets.

@vcidst
Last active April 7, 2017 08:35
Show Gist options
  • Save vcidst/8ff5afd691f4700f9b35 to your computer and use it in GitHub Desktop.
Save vcidst/8ff5afd691f4700f9b35 to your computer and use it in GitHub Desktop.
Send confirmation emails to people with Google Forms
/******************************
Code.gs
by vcidst
Add this to your spreadsheet that is linked to the form.
You can add this by going to Tools > Script Editor.
Edit accordingly. Everything in between the quotes is regular HTML.
*******************************/
function onFormSubmit(e) {
var yourName = e.values[1]; //appropriate column number here
var toAddress = e.values[6]; //column numbers start from 0
var phoneNumber = e.values[5]; //Here, 5 stands for the 6th column
var subject = "JECRC MUN 2014: Response Recorded";
var emailBody = "Thank you for your applying as a delegate at JECRC MUN 2014" +
"\n\nThe details you entered were as follows: " +
"\nYour Name: " + yourName +
"\nYour Email: " + toAddress +
"\nYour Contact Number: " + phoneNumber;
var htmlBody = yourName + ",<br/>&nbsp;<br/>Thank you for your <b>JECRC MUN 2014</b> delegate application" +
". Your response has been recorded.<br/>You can find additional conference details " +
"<a href='https://dl.dropboxusercontent.com/u/218756607/confdetails.pdf' target='_blank'>here</a>.<br/>&nbsp;<br/>" +
"Keep in touch with us at <a href='http://www.jecrcmun.co.in/' target='_blank'>http://jecrcmun.co.in</a> " +
"or at <a href='https://www.facebook.com/jecrcmun' target='_blank'>Facebook</a>" +
"<br />Feel free to email us at info@jecrcmun.co.in in case of any queries.<br/>&nbsp;<br/>" +
"<p>Warmest wishes,</p>" +
"<p>The JECRC MUN Team</p>";
var optAdvancedArgs = {name: "JECRC Model UN Conference 2014", htmlBody: htmlBody};
MailApp.sendEmail(toAddress, subject, emailBody, optAdvancedArgs);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment