Вы находитесь на странице: 1из 4

1/28/2014

How to Send Confirmation Emails After a Google Form is Submitted

How to Send Confirmation Emails with Google Forms


Summary: Learn how to send automatic confirmation emails to the users email address after they submit a Google form. You may also CC a copy of the form to yourself. By Amit Agarwal.

I maintain the India blogs directory (http://indianbloggers.org/) and it accepts entries through a simple Google Form (https://docs.google.com/forms/d/1Zy0c9CX9JkcR50dXrdmOSw3OfD4ZzvklCwNFYsknPM/viewform) . 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. Heres a sample confirmation email generated and sent through Google Forms:

A sample auto confirmation email 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?

http://www.labnol.org/internet/auto-confirmation-emails/28386/

1/4

1/28/2014

How to Send Confirmation Emails After a Google Form is Submitted

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 (http://www.y outube.com/watch?v =z6klwUx RwQI) on setting up Google forms and getting input values to an email address (http://www.labnol.org/internet/googledocs-email-form/20884/) 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: 1. 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. 2. 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. 3. Copy-paste the following script into the script editor and hit the floppy icon to save the script. 4. Inside the Script Editor, choose Run Initialize and authorize the script to send emails on your behalf. Thats it. When anyone submits the form, theyll get an automatic confirmation email in HTML (http://www.labnol.org/internet/send-html-email/19672/) . You will be included in the CC.

Google Script Send Mail to Form Submitter

http://www.labnol.org/internet/auto-confirmation-emails/28386/

2/4

1/28/2014

How to Send Confirmation Emails After a Google Form is Submitted

1 . 2 . 3 . 4 . 5 . 6 . 7 . 8 . 9 . 1 0 . 1 1 . 1 2 . 1 3 . 1 4 . 1 5 . 1 6 . 1 7 . 1 8 . 1 9 . 2 0 . 2 1 . 2 2 . 2 3 . 2 4 . 2 5 . 2 6 . 2 7 . 2 8 . 2 9 . 3 0 . 3 1 . 3 2 . 3 3 . 3 4 . 3 5 . 3 6 . 3 7 . 3 8 . 3 9 . 4 0 . 4 1 . 4 2 . 4 3 . 4 4 . 4 5 . 4 6 . 4 7 . 4 8 . 4 9 . 5 0 . 5 1 . 5 2 . 5 3 . 5 4 . 5 5 . 5 6 . 5 7 . 5 8 . 5 9 . 6 0 . 6 1 . 6 2 . 6 3 .

/ *S e n dC o n f i r m a t i o nE m a i lw i t hG o o g l eF o r m s* / f u n c t i o nI n i t i a l i z e ( ){ v a rt r i g g e r s=S c r i p t A p p . g e t S c r i p t T r i g g e r s ( ) ; f o r( v a rii nt r i g g e r s ){ S c r i p t A p p . d e l e t e T r i g g e r ( t r i g g e r s [ i ] ) ; } S c r i p t A p p . n e w T r i g g e r ( " S e n d C o n f i r m a t i o n M a i l " ) . f o r S p r e a d s h e e t ( S p r e a d s h e e t A p p . g e t A c t i v e S p r e a d s h e e t ( ) ) . o n F o r m S u b m i t ( ) . c r e a t e ( ) ; } f u n c t i o nS e n d C o n f i r m a t i o n M a i l ( e ){ t r y{ v a rs s ,c c ,s e n d e r n a m e ,s u b j e c t ,h e a d e r s ; v a rm e s s a g e ,v a l u e ,t e x t b o d y ,s e n d e r ; / /T h i si sy o u re m a i la d d r e s sa n dy o uw i l lb ei nt h eC C c c=S e s s i o n . g e t A c t i v e U s e r ( ) . g e t E m a i l ( ) ; / /T h i sw i l ls h o wu pa st h es e n d e r ' sn a m e s e n d e r n a m e=" Y o u rN a m eG o e sH e r e " ; / /O p t i o n a lb u tc h a n g et h ef o l l o w i n gv a r i a b l e / /t oh a v eac u s t o ms u b j e c tf o rG o o g l eD o c se m a i l s s u b j e c t=" G o o g l eF o r mS u c c e s s f u l l yS u b m i t t e d " ; / /T h i si st h eb o d yo ft h ea u t o r e p l y m e s s a g e=" W eh a v er e c e i v e dy o u rd e t a i l s . < b r > T h a n k s ! < b r > < b r > " ; s s=S p r e a d s h e e t A p p . g e t A c t i v e S h e e t ( ) ; h e a d e r s=s s . g e t R a n g e ( 1 ,1 ,1 ,s s . g e t L a s t C o l u m n ( ) ) . g e t V a l u e s ( ) [ 0 ] ; / /T h i si st h es u b m i t t e r ' se m a i la d d r e s s s e n d e r=e . n a m e d V a l u e s [ " E m a i lA d d r e s s " ] . t o S t r i n g ( ) ; f o r( v a rii nh e a d e r s ){ v a l u e=e . n a m e d V a l u e s [ h e a d e r s [ i ] ] . t o S t r i n g ( ) ; / /D on o ts e n dt h et i m e s t a m pa n db l a n kf i e l d s i f( ( i! = =" 0 " )& &( v a l u e! = =" " ) ){ m e s s a g e+ =h e a d e r s [ i ]+': :'+v a l u e+" < b r > " ; } } t e x t b o d y=m e s s a g e . r e p l a c e ( " < b r > " ," \ n " ) ; G m a i l A p p . s e n d E m a i l ( s e n d e r ,s u b j e c t ,t e x t b o d y , { c c :c c ,n a m e :s e n d e r n a m e ,h t m l B o d y :m e s s a g e } ) ; }c a t c h( e ){ L o g g e r . l o g ( e . t o S t r i n g ( ) ) ; } }

http://www.labnol.org/internet/auto-confirmation-emails/28386/

3/4

1/28/2014

How to Send Confirmation Emails After a Google Form is Submitted

This story was originally published at Digital Inspiration (www.labnol.org) by Amit Agarwal (amit@labnol.org). This printer-friendly version is made available for your personal and non-commercial use only.

http://www.labnol.org/internet/auto-confirmation-emails/28386/

4/4

Вам также может понравиться