How can I use Google Sheets to send an email from a static HTML page?

 

What Is this about?

You may have an example static website developed using HTML, CSS, and javascript that includes a contact page.

 


A contact page, as you may know, will receive some information from users such as his Email, Name, and message and then save them to the database. You will have a page in your backend where you can view contact messages and respond to users.

 


Or perhaps you need to send an email from your website but don't want to utilize a server-side language such as php, asp, node.js, or another. You wish to send an email without utilizing an SMTP server at all.

In this post or brief lecture, I will demonstrate how to send an email to a static website using only javascript and the Google Sheets service.

 

A Step-by-Step Guide

  1. The first step is to click on the following link:  Google Sheets Link 
  2. Select Make a Copy. A spreadsheet will be shown in front of you.
  3. If desired, rename the file.
  4. Select Tools > Script Editor.
  5. Go to line 8, uncomment it, and send the email to the intended recipient.
  6. Save the script, then go to file > manage versions > provide a description, and then save the version.
  7. Select Publish > Deploy as a web app from the drop-down menu.

Make sure to pick the project version (there must be one in your instance), but if you save a different version of the script, make sure to select the correct one.

 

And make access available to anybody, even if they are anonymous.

Click update, and if it prompts you to authenticate, simply click allow.

8.Make a copy of the produced script (we will use this in our page)

9. Now, download the HTML contact page test: (We have two examples: one basic and one async call to conceal the success message.)

Open the file and navigate to this section:

In the action value, paste the script URL you obtained from Google Sheets in step 8.

 

10. Now, open the file in the browser and test it by filling out the form and clicking the send button.

 

Check your inbox to check whether the magic has worked!

 

On addition, each email you send will be logged in the online Google sheet.

detail Instructions with image click here


LihatTutupKomentar