I am trying to send a mail using gmail API with POSTMAN, using POST Method
POST https://www.googleapis.com/upload/gmail/v1/users/[email protected]/messages/send
but I get an error below:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalidArgument"
"message": "Recipient address required"
}
],
"code": 400,
"message": "Recipient address required"
}
}
header is already putted Content-type: message/rfc822
I know that this has to be encoded into base64(web_safe), so I translated
"From: [email protected]\r\n" +
"To: [email protected]\r\n" +
"Subject: Subject Example\r\n" +
"This is content: hope you got it\r\n"
I also replaced them to be web_safe
replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
so I got an base64 like below. so I put raw in body of POST METHOD
{
"raw": "RnJvbTogc2VuZGVyLmV4YW1wbGVAZ21haWwuY29tDQpUbzogcmVjZWl2ZXIuZXhhbXBsZUBnbWFpbC5jb20NClN1YmplY3Q6IFN1YmplY3QgRXhhbXBsZQ0KVGhpcyBpcyBjb250ZW50OiBob3BlIHlvdSBnb3QgaXQNCg"
}
I used 'try this api' on google developers' site, and I could send it. https://developers.google.com/gmail/api/v1/reference/users/messages/send
But with POSTMAN, I cannot.
Any help please?