mailto links in Gmail
Asked Answered
P

8

21

I've encountered a problem with Gmail's web application. For some reason, the mailto links doesn't work when I try to add the body into the link. The links works fine as long as the & separator for the body is not used.

For example:

href="mailto:?subject=test&body=this is a test" - Doesn't work

href="mailto:?subject=testbody=this is a test" - Does work but, obviously, it doesn't generate the desired result as everything goes to the subject.

I am running Vista 64bit and I've tried FF, Chrome and IE. Also, I've noticed a difference between how Gmail renders my mail in my Gmail account and Google Apps account.

When i view the same email on my iPhone & Outlook everything seems to work fine.

Any help will be appreciated.

Publias answered 16/1, 2011 at 21:7 Comment(3)
What happens when you use & instead of &?Carsick
Same thing, I've tried & %26 and &amp/ but they all produced the same result.Publias
mailto: links with parameters are a non-standardized, unreliable thing in the first place. I wouldn't be surprised if there are more applications other than GMail out there that doesn't support them properly (maybe even on purpose due to security concerns). I would avoid them and look for more reliable solutions to your objective.Blankenship
I
9

I can get everything to populate on the gmail interface using their full url:

https://mail.google.com/mail/u/0/?view=cm&fs=1&tf=1&[email protected]&subject=MISSED%20CALL%20EZTRADER&body=Hello%2C%0A%0AI%20tried%20contacting%20you%20today%20but%20you%20seem%20to%20have%20missed%20my%20call.%20%0A%0APlease%20return%20my%20call%20as%20soon%20as%20you%E2%80%99re%20available.%20%0A%0AIn%20any%20case%2C%20I%20will%20try%20ringing%20you%20at%20a%20later%20time.%0A%0A%0ATy%2C%0A%0A%0A%0A
Instar answered 12/6, 2015 at 9:58 Comment(1)
When using the full url for populating an email on gmail use the link above but for the subject line use &su= instead of &subject.Instar
S
1

Try href="mailto:?subject=test&body=this+is+a+test"

Sluggard answered 16/1, 2011 at 22:17 Comment(0)
K
1

dude , even if I didn't encoding '&', however I replace followings characters, and then pass the email body and subject to mailto, it does work for me. Hope this may brings you some ideas.

body = body.replaceAll("\\\\", "%5C");
body = body.replaceAll(" ", "%20");
body = body.replaceAll("\r", "%0D");
body = body.replaceAll("\n", "%0A");
body = body.replaceAll("\t", "%09");
Kennykeno answered 25/11, 2011 at 2:53 Comment(0)
E
1

Tested in Firefox 19 - working.
In Chrome you need to install an extension to get it working.

The page I tested - https://dl.dropbox.com/u/60854445/mail.html
Chrome extension - https://chrome.google.com/webstore/detail/mailto-for-gmail/dgkkmcknielgdhebimdnfahpipajcpjn/

Maybe they have fixed it.

Effendi answered 12/3, 2013 at 19:24 Comment(0)
S
1
try this
<a href="mailto:[email protected]?subject=SweetWords&body=Please send me a copy of your new program!">Email Me</a>
Synchromesh answered 30/5, 2013 at 3:18 Comment(0)
C
1

Consider swapping the spaces for %20. Also, what is the formatting problem? Or better clarity in all would be helpful. you said "the mailto links doesn't work" and "Gmail renders my mail in my Gmail account and Google Apps account". Is it sending it or not, and if it's sending to both what specifically is the difference.

Canzonet answered 30/5, 2013 at 15:3 Comment(0)
G
0

As you can see in RFC 2368, this is not possible at all:

The special hname "body" indicates that the associated hvalue is the body of the message. The "body" hname should contain the content for the first text/plain body part of the message. The mailto URL is primarily intended for generation of short text messages that are actually the content of automatic processing (such as "subscribe" messages for mailing lists), not general MIME bodies.

Gleason answered 22/5, 2013 at 17:48 Comment(0)
B
0

I was struggling to find out why &subject= doesn't work in href for Gmail.


So I found this &su= to make subject work.

See example below:

href="https://mail.google.com/mail/?view=cm&fs=1&tf=1&to={{[email protected]}}&su=Subject&body=Body%20Text"

%20 - space

%0A - new line
Blasphemy answered 26/2, 2021 at 23:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.