/****************************************************************************** * This tutorial is based on the work of Martin Hawksey twitter.com/mhawksey * * But has been simplified and cleaned up to make it more beginner friendly * * All credit still goes to Martin and any issues/complaints/questions to me. * ******************************************************************************/ var TO_ADDRESS = "contact.nelsonic@gmail.com"; // where to send form data function doPost(e) { try { Logger.log(e); // the Google Script version of console.log see: Class Logger MailApp.sendEmail(TO_ADDRESS, "Contact Form Submitted", JSON.stringify(e.parameters)); // return json success results return ContentService .createTextOutput( JSON.stringify({"result":"success", "data": JSON.stringify(e.parameters) })) .setMimeType(ContentService.MimeType.JSON); } catch(error) { // if error return this Logger.log(error); return ContentService .createTextOutput(JSON.stringify({"result":"error", "error": e})) .setMimeType(ContentService.MimeType.JSON); } }