jaykay12 / jaykay12.github.io

This Repository hosts the source code of my personal portfolio website.
https://jaykay12.github.io
2 stars 8 forks source link

Solving your email problem without use of formspree #17

Closed meetanubhav closed 6 years ago

meetanubhav commented 6 years ago

4 #15

Steps to configure without using 3rd party apps. You can have all the feedbacks in a single form and unlimited number of mails. Best from formspree.io

  1. Open google drive and open excel sheet. 2.Next select script editor in the google sheet. 3.Write JavaScript file for your configuration. 4.Set the TO_ADDRESS in the Script ( in this column write your email address)

Script for Google sheet part

var to ="contact.youremail@gmail.com"; //Your email address where the data will be send
function post(e) {
    try{
        Logger.log(e);
        MailApp.sendEmail(to,"Contact form Submitted",JSON.stringify(e.parameters));
    return ContentService.createTextOutput(
        JSON.stringify({"result":"success","data": JSON.stringify(e.parameters) })).setMimeType(ContentService.MimeType.JSON);
    }
catch(error){
    Logger.log(error);
  return ContentService.createTextOutput(JSON.stringify({"result":"error","error":e})).setMimeType(ContentService.MimeType.JSON);
    }
}

5.Save a New Version of Your Script 6.Go to File-> Manager Version option to set Version 7.Publish the Updated Script as a Web App 8.Authorize the Script to Send Emails 9.Click Continue to authorize this app: next,Copy the web app URL to your clipboard / Notepad. Then click “OK”. 10.Create Your Basic HTML Form In form action method = "adress this google drive link file" DONE!!