Google form automatic email can be easily triggered on the form submission.
Why Send Auto Reply
The default Google contact form feature provides a google docs spreadsheet with user responses, and responding to them needs to be done using manual emails. Sometimes its not feasible to reply back to people immediately, I have found some of the main reasons as listed below
- In case your site is really popular and lot of people are trying to reach you.
- There may be lot of spam contact messages.
- There may be worldwide customers trying to reach you during odd working hours/weekends.
- You may be on vacation.
- You need some time to do research before you respond.
- Some of the categories need not be attended since your answers can be canned. e.g. you want to thank your customer for providing feedback or some help.
Below are simple steps to setup the auto reply email.
- Create Contact Form
In case you have not created the contact form before, don’t worry. Its really easy and free. Checkout this simple Youtube Video about “How To Create Contact Form on Google Docs“. This example assumes you have at least four fields in your contact form (Name, Email, Subject and content/message). Checkout our contact form for details.
Please make sure you take care of following things when you create a form and update any code in script.
- Google forms auto response will be sent immediately with email content configured in your script. Make sure to update the email response “message” in the script before you start using this.
- Field names are case sensitive. Please make sure the field names are exactly matching in the script. (e.g. Email, Subject)
- Make sure to update the script with your own email address on this line
var myemail = “firstname.lastname@example.org”;
- In case you want the auto reply content to be really big make sure you split it into multiple lines (and use Javasctipt append) like below instead of keeping all text in one double quote.
var message = “Thanks for contacting FromDev.com. We will get in touch with you shortly. nn—–nn”
+ “Another line n”
+ “Another line”;
The next steps is to add a trigger to run the script on form submission. The trigger is a simple configuration to tell google docs to listen to specific event and take action on it. We are simply going to create a trigger at the event of form submission and execute our auto reply email script in the action response to that event. Follow these steps
- Tools – Script Editor – Resources – Current Script’s Triggers
- Select Function name “sendAutoReply”
- Select “From Spreadsheet”
- Select “On Form Submit”
You need to Authorize Script to be run by Google API. The authorization step is really important since Google API will not run the script unless its authorized by the creator. Therefore make sure you are creating the script using the same account which owns the contact form.
I believe in test driven development, and as always try to make sure your setup is working fine. This is really simple, just do the form submission using a email address and see if the auto reply email is received as required.
Your script is still not working? There can be following reasons – Please make sure you have the exact same field names in your contact form. (Specially for Email and Subject). Checkout our contact form. – If someone enters a invalid email address or other error happens on your form, you would be notified with a email similar to below snapshot.
March 2013: Updated: Error Handling and Reply to Option as per reader feedback.
Hope you found this tutorial useful. Which contact form application are you using?