Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mailto links in Gmail

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.

like image 389
sagibb Avatar asked Jan 16 '11 21:01

sagibb


People also ask

How do I use mailto links in Gmail?

Select "Preferences" and scroll down to "Applications." Find or search for "mailto" in the search bar. Next to "mailto," open the dropdown menu and select "Use Gmail."

How do I set Gmail as my default email client for mailto links?

Google ChromeClick Show Advanced Settings at the bottom of the page. Under "Privacy," click Content Settings. Scroll down to the "Handlers" section, and click the Manage Handlers button. Select your desired, default email client (e.g. Gmail).

How do I get mailto links to open in Outlook instead of Gmail?

Open the Menu by clicking on the “hamburger” icon (3 lines above each other) in the top right corner-> Options-> tab Applications-> click on the “mailto” drop down list and select: Use Microsoft Outlook.


3 Answers

The Full mailto Link Syntax For Cross Browser

<a href="mailto:[email protected]?subject=subject&[email protected]">mail link</a>

Here are the variables you can use in mailto links:

mailto: to set the recipient, or recipients, separate with comma

&cc= to set the CC recipient(s)

&bcc= to set the BCC recipient(s)

&subject= to set the email subject, URL encode for longer sentences, so replace spaces with %20, etc.

&body= to set the body of the message, you can add entire sentences here, including line breaks. Line breaks should be converted to %0A.

Some mailto link examples

<a href="mailto:[email protected][email protected]&[email protected]&subject=Subject Using Mailto.co.uk&body=Email Using Body">Email-Link</a>

Multiple Recipients:

<a href="mailto:[email protected],[email protected],[email protected]">Contact Us</a> 

Online Generation Link : http://www.mailto.co.uk/

like image 160
Mohit Kumar Gupta Avatar answered Oct 18 '22 13:10

Mohit Kumar Gupta


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

But I still can't get the subject line to populate. I am still investigating, if anyone has an answer or knows the gmail encoding ref on the url for it?

like image 31
Michaelp Avatar answered Oct 18 '22 13:10

Michaelp


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");
like image 30
Xmagic Avatar answered Oct 18 '22 12:10

Xmagic