I'm having an issue with sending emails via the Gmail API. I followed the instructions as specified by various sources:
Message:
From: 'John Doe' <john.doe@gmail.com>\n
To: 'Jane Doe' <jane.doe@gmail.com>\n
Subject: This is a subject\n
Did you receive this message?
(I tried both with and without ', including specifying the email address directly)
I encoded this as base64 (url safe) and add it to the "raw" field of the body. Note that I pass the full JSON as the body.
{
   "raw":"RnJvbTogJ0pvaG4gRG9lJyA8am9obi5kb2VAZ21haWwuY29tPgpUbzogJ0phbmUgRG9lJyA8amFuZS5kb2VAZ21haWwuY29tPgpTdWJqZWN0OiBUaGlzIGlzIGEgc3ViamVjdApEaWQgeW91IHJlY2VpdmUgdGhpcyBtZXNzYWdlPw=="
}
(I tried both with and without padding)
I'm using the following HTTP headers:
   "headers":{
      "content-type":"message/rfc822",
      "authorization":"Bearer ya..."
   }
After doing a POST request to https://gmail.googleapis.com/upload/gmail/v1/users/john.doe@gmail.com/messages/send I get the following response:
{
  "error": {
    "code": 400,
    "message": "Recipient address required",
    "errors": [
      {
        "message": "Recipient address required",
        "domain": "global",
        "reason": "invalidArgument"
      }
    ],
    "status": "INVALID_ARGUMENT"
  }
}
EDIT: The official Google docs aren't really helpful regarding language neutrality.