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.
Top comments (0)