1

I'm working on an extension for chrome, where i need to compose gmail messages from URL. Anyone knows how i set the recipient and the subject via URL-Param?? Is there a better approach to do that or is this even possible? Thx

onlythoughtworks
  • 794
  • 8
  • 13
  • http://stackoverflow.com/a/12979218/1739100 See the answer above for majority of the code written for you. It's setup to be a chrome extension. – Brantley Blanchard Mar 04 '13 at 22:58

2 Answers2

6

@Pekka's response is good for a general mailto, but to get a Gmail compose window pre-filled, you need to use a URL like the following : http://mail.google.com/mail/?view=cm&fs=1&tf=1&to=TO_ADDRESS@example.com&cc=CC_ADDRESS@example.com&bcc=BCC_ADDRESS@example.com&su=SUBJECT&body=BODY -- with your parameters URL-encoded.

But be careful that you don't go beyond Google's character limit or you'll get a "414 - Request-URI Too Large" error, as explained in this StackOverflow question: Prefilling large volumes of body text in GMAIL compose getting a Request URI too long error

Community
  • 1
  • 1
Curtis Gibby
  • 884
  • 1
  • 12
  • 25
0

Check this article.

mailto:recipient@example.com?subject=Hi!&body=Hi!

You can even specify headers, I didn't know that.

Pekka
  • 442,112
  • 142
  • 972
  • 1,088