The mailto protocol lets you create hyperlinks that will directly launch the default email software and compose a new email message. Mailto commands in Firefox even work with web mail programs like Gmail.
You probably know how to use the mailto command for quickly linking to one email address but the mailto syntax actually allows a lot more – you can address the same message to multiple addresses, populate the cc, bcc or subject fields, and even write text inside the email body.
Remember to use %20 for the space character and %0A to add a line break in the body text.
You can test any mailto command by directly typing the command in the browser’s address bar.
Master the mailto Syntax
Let’s assume you maintain the official Whitehouse website and need to create mailto links that will make it easy for visitors to reach the president via email.
1. Send an email to Barack Obama (single recipient)
<a href="mailto:obama@whitehouse.gov">
2. Send an email to Barack and Michelle Obama (separate multiple recipients with a comma)
<a href="mailto:obama@whitehouse.gov,michelle@whitehouse.gov">
3. Send an email to Barack but put Michelle in the CC: list and Joe Biden in the BCC: list
<a href="mailto:obama@whitehouse.gov?cc=michelle@whitehouse.gov&bcc=joe@whitehouse.gov">
4. Send an email to Barack Obama with the subject "Congrats Obama"
<a href="mailto:obama@whitehouse.gov?subject=Congrats%20Obama">
5. Send an email to Barack Obama with the subject "Congrats Obama" and some text in the body of the email message
<a href="mailto:obama@whitehouse.gov?subject=Congrats%20Obama&body=Enjoy%20your%20stay%0ARegards%20">
You may use any permutations and combinations while writing a mailto hyperlink but make sure that there’s only one "?" character.
Find this article at: http://www.labnol.org/internet/email/learn-mailto-syntax/6748/

Reader Comments
Very useful post, Amit!
Thank you for linking to the ‘mail-to’ documentation. I was looking for this recently.
Written by Jacob on 01.27.09
It seems that there are character limits – Outlook Express can handle at a maximum 456 characters in the mailto link. Any more and a message might popup stating ‘Could not perform this operation because the default mail client is not
properly installed.’
The W3C HTML specs also mention a 256 character limit, I believe, although I can’t locate any reference to it.
Lotus Notes users have also complained in the past about a 255 character limit.
Written by Sparx on 01.27.09
How do you make these links spambot proof (or resistant at least)? Putting an email address on a web page has gotten me onto too many lists in the past.
Written by Stephan on 01.27.09
One should be able to use ? for ? mark in case its needed in the subject or the body.
Written by Diabolic Preacher on 01.28.09
@stephan: The service is Spambutcher’s Spamfreeze – link
Written by Sparx on 01.28.09
@Sparx
Not sure your answer addresses my question. What I meant was if I use the suggested “href”s (above) on a web page, there’s nothing (that I can see) to prevent a spambot from harvesting all of the information.
I can’t see how a 3rd party spam filtering solution would help in that case.
However, I can see using it (or something similar) in a server side php script, etc.
Written by Stephan on 01.28.09
Link Obfuscator – link
Use that service to generate a link that will appear in the source as HTML numbers in place of the actual character. Again, this is a very simple way of hiding one’s email address.
I entered:
[code]obama@whitehouse.gov?subject=Congrats%20Obama&body=Enjoy%20your%20stay%0ARegards%20[/code] and the appropriate long code was generated correctly.
@Diabolic Preacher: use the term %3F instead of the question mark symbol just as you would %20 instead of space.
See here – link for URL escape codes.
Written by Sparx on 01.29.09
@Sparx
That was a good one Sparx, But in any case the user will be able to see the email id in status bar. So, what do you mean by hiding email id.
Written by rakesh on 03.04.09