On some websites when I click the contact email link, I get either a list or some icons for common email programs like gmail, yahoo, hotmail, etc., and I can pick which email program I want to open, then the email program opens and fills in the To: and Subject: fields. I can't find any web pages to show as an example, but I have seen it sometimes with Craigslist. Does anybody know how to code for this?
Asked
Active
Viewed 740 times
0
-
4"view source" on the page that does it. – Dec 10 '12 at 20:28
-
My smart phone does that automatically with pretty much all email links (offering a choice between the email apps associated with each account); I've never seen it on my PC, though normally a website _couldn't_ open my gmail or yahoo mail accounts with pre-filled fields on my PC because normally I'm not actually logged in to those accounts. – nnnnnn Dec 10 '12 at 20:32
-
If I could find a page that does that, I would view the source. I've seen these pages before, but I can't find one now. – user1892770 Dec 10 '12 at 21:43
2 Answers
1
You can populate subject and body - in most e-mail clients - like this:
<a href="mailto:example@example.com?subject=Subject+line&body=Body+goes+here.">E-mail</a>
This is usually a far better solution than making the user pick their provider and relying on an undocumented and subject-to-change URL format of some sort, not to mention it works with desktop clients like Outlook.

ceejayoz
- 176,543
- 40
- 303
- 368
-
-
@Dagon mailto links open my Gmail (Chrome). Most browsers are starting to implement this sort of thing. – ceejayoz Dec 10 '12 at 20:56
-
only gives you one option, if you have 6 web mail apps, maybe giving the user a chose of what to use is a good idea. – Dec 10 '12 at 20:57
-
I'm ok with only one option if the default option is the one that I or my website visitors prefer, however, for many people the default is Outlook but the preferred email is gmail, hotmail, Yahoo, etc. I understand that each visitor to my website can set the preferred mail in their browser but my website visitors are not technically savvy enough to do that. – user1892770 Dec 10 '12 at 21:47
0
viewing source on craigslist you can see the urls; this is gmails:
https://mail.google.com/mail/?view=cm&fs=1&to=TOADDRESS&su=SUBJECT&body=BODY&tf=1&shva=1
you want to check each sites documentation for the particulars
-
down vote? oh the horror :-) No seriously who are you and where do you live? I'm coming for you! - Just kidding (or am i ?) Don't be surprised when you wake up to find the head of TH̘Ë͖́̉ ͠P̯͍̭O̚N̐Y̡ in your bed. – Dec 10 '12 at 20:52
-
Were you presented with a list of mails, or a list of mail icons or when you clicked did it default to gmail? I understand that I could make a separate link for each mail client, for example the link above for gmail and a separate link for hotmail. – user1892770 Dec 10 '12 at 21:50
-
i selected gmail from the list on the site. clicking on the "reply to this post" on any listing hives you a list of options – Dec 10 '12 at 23:10
-
I found a webpage on Craigslist which has the example, what it does is when you click the Reply button, it opens a list of links to various email providers like the gmail code posted above. Sorry my question was misleading, I couldn't remember how they did that. I consider this answered by Dagon. Thanks to everybody for helping. – user1892770 Dec 11 '12 at 00:20
-
I grabbed the code from Craigslist and it gives me an example for everything I need except one thing, I can't get the "Reply to this post" button to toggle the email options to show and hide (or visible/not visible). I tried putting some sample code on a web server and I tried making sure any javascripts were included, but I still can't get the Reply button to toggle. – user1892770 Dec 11 '12 at 14:46
-
I will mark this as solved and if I can't figure out how to make the Reply button toggle, then I will post a question with only that problem. Thanks again for the help. – user1892770 Dec 11 '12 at 16:09