DEV Community

Aditya Kumar
Aditya Kumar

Posted on

1

Sending Emails with Gmail using API

We're going to build an API that use Google App Script to send emails utilizing the Gmail API.

Github Code

Prerequisites

  • Basic JavaScript knowledge
  • Basic API knowledge
  • A Google Account

How to Build

  1. Open Google Sheets
  2. Now click on Blank Spreadsheet. Google forms home page
  3. This will create a Blank Spreadsheet. In my case I am naming it Email API.
  4. Now click on Extensions and then select Apps Script. Google form spreadheet
  5. Now it will open a code editor. Name your project if you want.app script code editor
  6. Copy and paste the code from Github. Press Ctrl + S to save the code.
  7. Click on Deploy, and then New Deployment. web app deployment

  8. Now Select Type and then Web App. deployment 1

  9. You have to fill some details here.

    • Description: Write anything you want
    • Executes as : Me (your email)
    • Who has access: Anyone
  10. After filling details click on Deploy and authorize application. deployment 2 deployment 3 deployment 4 deployment 5

  11. Now your project is deployed. Copy the URL and make a post request using postman or your project. deployed url

Make sure to include while making a POST request.

Content-Type: JSON

{
    "email":"",
    "subject":"",
    "body":""
}
Enter fullscreen mode Exit fullscreen mode

Thanks for reading!

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

The Most Contextual AI Development Assistant

Pieces.app image

Our centralized storage agent works on-device, unifying various developer tools to proactively capture and enrich useful materials, streamline collaboration, and solve complex problems through a contextual understanding of your unique workflow.

👥 Ideal for solo developers, teams, and cross-company projects

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay