Mahesh Durgam
Mahesh Durgam

Reputation: 33

How to send mail using gmail rest api from postmnan native application

My requirement is that send an email to some recipient with text body using POSTMAN Native app, I used the below endpoint with requested data,

  1. Base URL: https://www.googleapis.com/gmail/v1/users/userId/messages/send
  2. Headers :Authorization:Bearer
  3. Request Method :POST
  4. Request body :{"raw";"to:[email protected]","subject":"Test_Mail"}
  5. Clicking Send button

But getting error response code 400,required recipient address Please help me in this to send an email using POSTMAN,and I've tried with upload end point too -https://www.googleapis.com/upload/gmail/v1/users/[email protected]/messages/send

Thanks in advance,looking for help guys

Upvotes: 0

Views: 8389

Answers (2)

the_cuaz
the_cuaz

Reputation: 206

Came across your question trying to figure this out myself today.

  1. Request body : {"raw";"to:[email protected]","subject":"Test_Mail"}

The raw param should be a complete email message that's base64-encoded.

i.e.: {"raw": "VG86IHVzZXIxbWFpbEBnbWFpbC5jb20KU3ViamVjdDogVGVzdF9NYWls"}

Upvotes: 1

ReyAnthonyRenacia
ReyAnthonyRenacia

Reputation: 17613

400 error means bad request, which could mean there are missing or wrong parameters. Check the Users.messages.send

Path parameters

userId string The user's email address. The special value me can be used to indicate the authenticated user.

Required query parameters

uploadType string The type of upload request to the /upload URI. Acceptable values are:

media - Simple upload. Upload the media only, without any metadata.

multipart - Multipart upload. Upload both the media and its metadata, in a single request.

resumable - Resumable upload. Upload the file in a resumable fashion, using a series of at least two requests where the first request includes the metadata.

Upvotes: 0

Related Questions