Introduction.

Sometimes you have a sample static websites created with HTML, CSS, and javascript and you may have a contact page on that website.

As you know a contact page will accept some fields from users like his Email, Name, message and then save them to the database. In your backend, you will have a page that can see that contact messages and reply to users from.

Or maybe you need to send an email from your website, but you don’t want to use any server-side language like php,asp,node.js, or any other language. you want to send an email without even using any SMTP server.

In this article or small lecture, I will show you how to send an email to your static page using only javascript and google sheets service.

Step by Step Guide.

1. The first thing you have to do is to open the link below:

Google Sheet Copy Link

2. Click on make a copy. You will see a spreadsheet on front of you.

3. Rename the file if you want.

4. Click on tools > script editor.

5. Go to line number 8, uncomment and send the target email you want to send to.

6. Now save the script then click on file > manage versions > write any description and click on save version.

7. Click on publish > Deploy as a web app.

Make sure to select the project version( in your case must be one) but when you save a different version of the script, select the right one.

And leave access to anyone, even anonymous.

Click update and if it asks for authenticating just click allow.

8.Copy the generated script (we will use this in our page)

9. Now download the test HTML contact page: (we have two examples, one is basic, and the other is an async call to hide the success message)

Download basic example

Download Async example

Open the file and go to this part:

Paste the script link you got from google sheets in step 8 in the action value.

10. Now open the file in the browser and test it, just fill the form and click send.

Check your inbox to see the magic!

Also, every email you send will be recorded in the online google sheet.

This article is based on a GitHub tutorial, check it here.