2
votes

If you visit:

https://mail.google.com/mail/?view=cm&to=stacko%40barrycarter.info&su=Sending%20email%20from%20stack%20post&body=hi+barry+i+am+sending+you+email+from+a+stack+post

and are logged into gmail, you will see a "compose mail" window with a default subject and body text.

Is this documented anywhere? Are there other fields I can set (in addition to su= and body=)? Can I use POST if I want to pre-fill the composer with a long message?

Googling was unhelpful, but I might have been doing it wrong.

2
IF it is documented somewhere, it is here: developers.google.com/gmailJeroen
I did visit developers.google.com/appengine/docs/python/mail/sendingmail before asking, but this appears to use Python functions (which, admittedly, may just be a wrapper around the URL version). I'm wondering if the 'raw' URL "API" is documented.user354134

2 Answers

0
votes

It seems that the google API is mostly in accordance with the mailTo Api, as defined in RFC2368 and RFC6068. Of the five parameters, four are identical (such as to, cc, bcc and body) and one received only slight modification (su is gmail's version of subject).

In fact, it seems that the RFC's define extended url's, which take even more parameters and look like this: https://mail.google.com/a/gsuitedomain.com/mail/?extsrc=mailto&url..., and these URL's, also, work! (Thanks to Tobias Mühl for discovering this!) Though, for the rest of us, to= and body= will be much simpler, but now there is a degree fo certainty in the API that they are following.

Unfortunately, I wasn't able to locate any official API published directly by Google themselves.

Parameters :

  • to - Email to who
  • su (gmail API) / subject (mailTo API) - Email Title
  • body - Email Body
  • bcc - Email Blind-Carbon Copy
  • cc - Email Carbon Copy address

...are widely accepted and used by the community. For instance, see this popular answer that accepts these parameters without providing documentation: URL to compose a message in Gmail.

So, your end result looks like...

https://mail.google.com/mail/?view=cm&to={email_address}&su={title}&body={url}&bcc={email_address}&cc={email_address}

This is just a summary of the Gmail-section of my Social Share URLs Github project - Social Share URLs.

-2
votes

The Gmail API is documented here. Disclaimer: The send method is crap (i.e. poorly documented)