How to force web-browser to navigate to Gmail and create (if logged in) new letter with filled in field 'To' on click on mailto:SomeMail@blabla.example
?

- 23,933
- 14
- 88
- 109

- 25,747
- 28
- 93
- 153
-
What Language? With Addons? Browser Script? Java? C#? C++? – Aug 08 '11 at 20:50
-
C#? Java? C++??? Any another ideas? Ok, I've added tags. By the way, I am interested in any solutions, not only scripting. – Sergey Metlov Aug 08 '11 at 20:53
-
1The context is important. From a webpage? A desktop application? – Quentin Aug 08 '11 at 21:02
-
2I've write 'web-browser'. Isn't it enough? – Sergey Metlov Aug 08 '11 at 21:03
-
2Not necessarily. In general, what can be achieved with "code in a webpage", "code in a browser extension" and "a local application interacting with a browser" are radically different. – Quentin Aug 08 '11 at 21:12
-
I would have interpreted this question differently if it was on Super User. – Benjamin Atkin Aug 08 '11 at 21:23
6 Answers
There's a Greasemonkey script. The compose URL is:
https://mail.google.com/mail/?view=cm&fs=1&to=email@domain.example

- 23,933
- 14
- 88
- 109

- 10,602
- 2
- 36
- 38
-
13Great answer! Looking at the source I see that `cc`, `su` (subject), and `body` are also available as URL parameters. – Benjamin Atkin Aug 08 '11 at 21:22
-
1Hi Vlad, Can we attach documents to the same link you have given? I want to open mail composer with attached documents. – Poorav Solanki Mar 09 '17 at 06:05
-
Hello, link works but default signature not showing. Signature works at gmail.com but not when opening with the custom link. Any idea why? – karlosuccess Mar 09 '22 at 18:51
<a href="https://mail.google.com/mail/?view=cm&fs=1&tf=1&to=someone@example.com" target="_blank">Title</a>

- 23,933
- 14
- 88
- 109

- 1,382
- 1
- 13
- 16
mailto is one of many URL Protocols and it's a way for commands to exit the browser and interact with other applications. I can't find a good site defining what a URL Protocol is but here's how one is registered, it also describes how one is called: http://msdn.microsoft.com/en-us/library/aa767914(v=vs.85).aspx
As a web developer, you won't be able to twist mailto to do what you want on your site. You can use this link:
https://mail.google.com/mail/?view=cm&fs=1&tf=1&to=target@email.example
Not suggested though. Anybody who clicks it needs to be signed into their gmail account (if they have one), but it technically works if the user has gmail and is signed in.
As a user, if you want other sites' mailto links to take you to gmail, then whatever browser you have is bound to have an extension or plug-in you can use that will manipulate mailto links to the link I gave you above.

- 23,933
- 14
- 88
- 109

- 24,072
- 31
- 113
- 188
-
I think *this* is what the asker wanted to know. I think it's fair to say it's not suggested. It's useful in some cases, though, because it can be a pain to get mailto: working properly. I agree that using a browser extension or operating system protocols is better in the long run, but it can be a nice option to have in settings for an online CRM app. Also depending on user feedback, the option might need to be extended to include google apps for domains and other email providers. – Benjamin Atkin Aug 08 '11 at 21:15
-
Ripped this from Craigslist: https://mail.google.com/mail/?view=cm&fs=1&to=kxps2-6529650434%40sale.craigslist.org&su=Mattress+and+gas+grill&body=%0A%0Ahttps%3A%2F%2Flosangeles.craigslist.org%2Fwst%2Fzip%2Fd%2Fmattress-and-gas-grill%2F6529650434.html%0A you can see how they set the "Subject" as "su" – chrisallick Mar 13 '18 at 22:50
To add Subject, Body, CC, and BCC, just add the parameters to the URL:
- Carbon Copy (CC) is the parameter "cc"
- Blind Carbon Copy (BCC) is the parameter "bcc"
- Subject is the parameter "su"
- Body is the parameter "body"
Example:
https://mail.google.com/mail/?view=cm&fs=1&to=someone@example.com&cc=someone@ola.example&bcc=someone.else@example.com&su=SUBJECT&body=BODY
Or:
<a href="https://mail.google.com/mail/?view=cm&fs=1&to=someone@example.com&cc=someone@ola.example&bcc=someone.else@example.com&su=SUBJECT&body=BODY" target="_blank">Mail Us</a>

- 23,933
- 14
- 88
- 109

- 7,011
- 3
- 57
- 60
Above works also works. I tried following link in my <a>
tag.
https://mail.google.com/mail/u/0/#inbox?compose=new

- 468
- 4
- 12
Probably this would help -

- 9,156
- 3
- 39
- 53