// Insert variables from the spreadsheet into the subject. // In this case, I wanted the new hire's name and start date as part of the // email subject. These are the 3rd and 16th columns in my form. // This creates an email subject like "New Hire: Jane Doe - starts 4/23/2013" subject += e.namedValues[headers[2]].toString() + " - starts " + e.namedValues[headers[15]].toString();

// Send the email MailApp.sendEmail(email, subject, message);

// Based off of a script originally posted by Amit Agarwal - www.labnol.org // Credit to Henrique Abreu for fixing the sort order}