URL87 URL87 - 1 year ago 198
reST (reStructuredText) Question

Google REST API - message in an RFC 2822 formatted and base64url encoded string

I try the use the - try it of Google REST API - Users.messages: send .

There is there a required parameter -


The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in messages.get and drafts.get responses when
the format=RAW parameter is supplied.

I checked about RFC 2822 format and seems it should displayed as the sample here , then I encoded it the base64URL with this encoder and paste it the
field of the try it and I get -
Invalid value for ByteString: http://ostermiller.org/calc/encode.html

Can you provide me a correct
RFC 2822 format
and its corresponding
which it would work in the above try it ?

Answer Source

An example mail could look like this:

From: sender@gmail.com
To: receiver@gmail.com
Subject: Subject Text

The message text goes here

Open up the Developer Tools in your browser and Base64 encode it and replace all + with - and all / with _ to make it URL-safe:

  "From: sender@gmail.com\r\n" +
  "To: receiver@gmail.com\r\n" +
  "Subject: Subject Text\r\n\r\n" +

  "The message text goes here"
).replace(/\+/g, '-').replace(/\//g, '_');

This will give you the following data:


Use this string above as your raw-parameter in the API Explorer to send the mail.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download