If you want to create highly optimized contact us form then you have to know such advanced script like JavaScript, PHP, HTML5 etc. but a very good news is that Google drive offers creating Google forms (highly optimized for any site or blog) having multiple flexibilities like creating contact form, complex polls thereby Google forms are the excellent tool and best ever to me.
Creating Google forms are much easy but there is still trouble and that is when a user will send you message the junky snippets will go to your drive form that looks very ugly but if you redirect the message into your personal mail then it will a standard one. With Google script it's possible to redirect form messages into our mail and that is within 5 minutes. Let's see how
First Part: Creating Google Form With Google Drive
Redirecting Google Form Data to Your Personal Email
1. Go to Google Drive and create a contact form using existing Drive Theme or choose any custom theme. Once you have created the form now open form with Google form.2. Inside the form editor click on "View responses" to open Google Spreadsheet that collects responses from Google form.
3. While you're inside the spreadsheet, go to Tools -> Script editor, remove any existing code
4. Now copy paste following snippet.
/* Send Google Form by Email v2.0 */N.B. Script Credit: Amit Agarwal
/* For customization, contact the developer at amit@labnol.org */
/* Tutorial: http://www.labnol.org/?p=20884 */
function Initialize() {
var triggers = ScriptApp.getScriptTriggers();
for(var i in triggers) {
ScriptApp.deleteTrigger(triggers[i]);
}
ScriptApp.newTrigger("SendGoogleForm")
.forSpreadsheet(SpreadsheetApp.getActiveSpreadsheet())
.onFormSubmit()
.create();
}
function SendGoogleForm(e)
{
try
{
// You may replace this with another email address
var email = Session.getActiveUser().getEmail();
// Optional but change the following variable
// to have a custom subject for Google Form email notifications
var subject = "Google Docs Form Submitted";
var s = SpreadsheetApp.getActiveSheet();
var columns = s.getRange(1,1,1,s.getLastColumn()).getValues()[0];
var message = "";
// Only include form fields that are not blank
for ( var keys in columns ) {
var key = columns[keys];
if ( e.namedValues[key] && (e.namedValues[key] != "") ) {
message += key + ' :: '+ e.namedValues[key] + "\n\n";
}
}
// This is the MailApp service of Google Apps Script
// that sends the email. You can also use GmailApp for HTML Mail.
MailApp.sendEmail(email, subject, message);
} catch (e) {
Logger.log(e.toString());
}
}
5. Press Ctrl+S (or Cmd+S on Mac) to save the code and give your project any name (say “Send Google Forms by Email”)
6. Navigate to run menu and choose Initialize.
7. The Google script will now require you to authorize the script, just click "Continue"
8. Finally accept and you're done!
How to disable notification?
If you need to disable notifications, open the script editor again and choose Resources -> Current Script Triggers and delete the Form trigger associated with the "On Form Submit" action.Try Out Your Form and Check Email
I have tried out my form and it gave me the information well so i recommend you to try out the form and i'm sure it will work the same as me.Here is the information Google script sends to me
0 comments