DEV Community

Aravinth
Aravinth

Posted on

6 2

Send Gmail using POSTMAN

In Developer console google
CreateCredentials -> Select Application Type -> Web Application -> Add redirect Uri(https://oauth.pstmn.io/v1/callback) and create the clients

In Postman
Token name : Google OAuth token
Grant Type : Authorization Code
Callback Url : https://oauth.pstmn.io/v1/callback
Authorize Using browser
Auth Url : https://accounts.google.com/o/oauth2/auth
Access Token URL : https://accounts.google.com/o/oauth2/token
Client ID : .apps.googleusercontent.com (Obtained from Creating Projects in developer console)
Client Secret : *
**
Scope : https://www.googleapis.com/auth/gmail.send
Client Authentication: Send as Basic Auth header

Request Token will generate a new token with Mail send Access

Make Post Request to the following url
https://content.googleapis.com/gmail/v1/users/{mailaddress}@gmail.com/messages/send?alt=json&key={APIKEY}
{APIKEY} -> Generated in the Developer console

From: test@gmail.com
To: test@gmail.com
Subject: Test Email
Convert the following text into base64 format

Embed the {base64String} to raw format
{
"raw": {base64String}
}

Press the send button in the Postman .Mail sent from gmail account.

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post