I maintain the India blogs directory and it accepts entries through a simple Google Form. The workflow is something like this – when someone submits the Google Form, an automatic confirmation email arrives in their inbox informing them that their details have been successfully submitted.
These are similar to canned responses in Gmail but for Google Forms. You may use the trick for sending welcome messages, acknowledge support requests, and more. Here’s a sample confirmation email generated and sent through Google Forms:
Send a Confirmation Email to the Form Submitter
The other day I got an email from N.Vamsi asking me how to setup these auto-responders using Google Forms?
Would you mind telling me how you have set up auto email updater for inputs taken from Google forms. I have seen your video tutorial on setting up Google forms and getting input values to an email address but auto email responder is something new! Do you have any tutorials for that as well?
This is easy and you can can add the auto-reply feature to your Google Forms in less than a minute. Here are the steps involved:
- Go to your Google Drive and create a new Google Form. Add any number of fields to the form but make sure you have a field called “Email Address” where the submitter will input their email address.
- Assuming that you are saving your Google Form responses in a separate spreadsheet, open that sheet and choose the Script Editor option under the Tools menu.
- Copy-paste the following script into the script editor and hit the floppy icon to save the script.
- Inside the Script Editor, choose Run – Initialize and authorize the script to send emails on your behalf.
That’s it. When anyone submits the form, they’ll get an automatic confirmation email in HTML. You will be included in the CC.
Google Script – Send Mail to Form Submitter
/* Send Confirmation Email with Google Forms */
function Initialize() {
var triggers = ScriptApp.getScriptTriggers();
for (var i in triggers) {
ScriptApp.deleteTrigger(triggers[i]);
}
ScriptApp.newTrigger("SendConfirmationMail")
.forSpreadsheet(SpreadsheetApp.getActiveSpreadsheet())
.onFormSubmit()
.create();
}
function SendConfirmationMail(e) {
try {
var ss, cc, sendername, subject, headers;
var message, value, textbody, sender;
// This is your email address and you will be in the CC
cc = Session.getActiveUser().getEmail();
// This will show up as the sender's name
sendername = "Your Name Goes Here";
// Optional but change the following variable
// to have a custom subject for Google Docs emails
subject = "Google Form Successfully Submitted";
// This is the body of the auto-reply
message = "We have received your details.<br>Thanks!<br><br>";
ss = SpreadsheetApp.getActiveSheet();
headers = ss.getRange(1, 1, 1, ss.getLastColumn()).getValues()[0];
// This is the submitter's email address
sender = e.namedValues["Email Address"].toString();
for (var i in headers) {
value = e.namedValues[headers[i]].toString();
// Do not send the timestamp and blank fields
if ((i !== "0") && (value !== "")) {
message += headers[i] + ' :: ' + value + "<br>";
}
}
textbody = message.replace("<br>", "\n");
GmailApp.sendEmail(sender, subject, textbody,
{cc: cc, name: sendername, htmlBody: message});
} catch (e) {
Logger.log(e.toString());
}
}
This story, How to Send Confirmation Emails with Google Forms, was originally published at Digital Inspiration on 22/01/2014 under Google Forms, Internet
No comments:
Post a Comment