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.

Pbk1303
  • 3,702
  • 2
  • 32
  • 47
sagibb
  • 956
  • 2
  • 9
  • 21
  • 3
    What happens when you use `&` instead of `&`? – Alec Jan 16 '11 at 21:11
  • Same thing, I've tried & %26 and &amp/ but they all produced the same result. – sagibb Jan 16 '11 at 22:04
  • 2
    `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. – RoToRa Jan 16 '11 at 22:46

8 Answers8

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&to=target@email.com&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
General Grievance
  • 4,555
  • 31
  • 31
  • 45
Michaelp
  • 99
  • 1
  • 1
  • 5
    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. – Michaelp Jun 12 '15 at 10:04
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.

m93a
  • 8,866
  • 9
  • 40
  • 58
1
try this
<a href="mailto:email@echoecho.com?subject=SweetWords&body=Please send me a copy of your new program!">Email Me</a>
Vishal
  • 816
  • 11
  • 19
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.

1

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

Aurelio De Rosa
  • 21,856
  • 8
  • 48
  • 71
dantj
  • 11
  • 1
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");
Xmagic
  • 189
  • 1
  • 11
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.

General Grievance
  • 4,555
  • 31
  • 31
  • 45
Mike Van Stan
  • 396
  • 4
  • 17
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={{test@gmail.com}}&su=Subject&body=Body%20Text"

%20 - space

%0A - new line
Qui-Gon Jinn
  • 3,722
  • 3
  • 25
  • 32