Questions tagged [mailto]

Mailto is the URI scheme for email addresses. It is used in web pages as a link that opens a new email message to the specified to-address in the user's default email client.

Mailto is the URI scheme that targets the user's client from within the browser. Clicking a mailto link creates a new email message in the user's email client, optionally with to, cc, subject, and body pre-populated.

A mailto link can be inserted into a webpage using a standard link:

  • The simplest mailto link specifying a recipient addresses..

    <a href='mailto:someone@host.com'>Click to email</a>
    
  • Multiple recipients..

    <a href='mailto:nobody@host.com,nowhere@host.com'>Click to email</a>
    
  • Autofill the subject line..

    <a href='mailto:someone@host.com?subject=This%20is%20the%20subject'>Click to email</a>
    
  • Autofill the subject line and specify the email to be CC'd to..

    <a href='mailto:someone@host.com?cc=me@me.com&subject=Testing%20mailto&'>Click to email</a>
    
  • Mailto 3 people, with a BCC and a subject..

    <a href='mailto:someone@yoursite.com?cc=someoneelse@theirsite.com, another@thatsite.com, me@mysite.com&bcc=lastperson@theirsite.com&subject=Big%20News'>Click to email</a>
    
  • Autofill the subject line and body of the email with a linebreak..

    <a href='mailto:someone@host.com?subject=Readme&body=This%20is%20the%20first%20line%0D%0AThis%20is%20the%20second'>Click to email</a>
    
  • Add a reply-to address..

    <a href='mailto:someone@host.com?reply-to=me@me.com'>Click to email</a>
    

Special Character escaping

Within mailto URLs, the characters "?", "=", "&" are reserved.

Special characters that appear in addresses, headers or message contents must be encoded using a "%" followed by a two-digit hex number. See RFC3986 for a exhaustive description of URL encodings.

Space = %20             : = %3A         ] = %5D
Line Break = %0D%0A     ; = %3B         { = %7B
" = %22                 ' = %27         } = %7D
# = %23                 < = %3C         \ = %5C
$ = %24                 > = %3E         | = %7C
% = %25                 / = %2F         = = %3D
^ = %5E                 ? = %3F
& = &amp;               [ = %5B

8-bit characters in mailto URLs are forbidden.

More information

  • RFC 2368, which defines the mailto scheme.
1050 questions
954
votes
13 answers

Can I set subject/content of email using mailto:?

Is it possible to set the subject/content of email when I use mailto:?
Jiew Meng
  • 74,635
  • 166
  • 442
  • 756
345
votes
9 answers

mailto link with HTML body

I have a couple of mailto links in a HTML document. Can I insert HTML formatted body in the mailto: part of the href? Mail me Note that (2016) in iOS, it is…
GxG
  • 3,907
  • 2
  • 17
  • 18
196
votes
6 answers

Insert a line break in mailto body

I would like to insert a line break into my mailto body. I tried %0A, %0D and %0D%0A. Nothing worked for me. I tested on Gmail, Yahoo, Apple Mail, Outlook 2010, Outlook.com and Thunderbird with Google Chrome on Mac OSX. Any help please ? Here's my…
Marion
  • 1,963
  • 2
  • 9
  • 4
124
votes
4 answers

mailto link multiple body lines

having trouble getting multiple lines to work correctly in a mailto link In my case I'm testing it with an Outlook default mail reader. The following is put in an anchor…
KevinDeus
  • 11,150
  • 19
  • 61
  • 95
122
votes
7 answers

Is it possible to add an HTML link in the body of a MAILTO link

I have not had to mess with mailto links much. However I now need to add a link in the body of a mailto if it is possible. Is there a way to add a link or to change the email opened to an html email vs a text email? Something like:
StubbornMule
  • 2,470
  • 5
  • 19
  • 19
86
votes
11 answers

Hide Email Address from Bots - Keep mailto:

tl;dr Hide email address from bots without using scripts and maintain mailto: functionality. Method must also support screen-readers. Summary Email obfuscation without using scripts or contact forms Email address needs to be completely visible to…
user7234396
86
votes
4 answers

How do you create a mailto: link without the (to) part

How do you properly construct a mailto: link without the part. mailto:someaddress@example.com? I dont want the address and just want whats in the parameters afterward to be filled in through the mailto.
Chamilyan
  • 8,517
  • 10
  • 34
  • 67
83
votes
5 answers

Invoke / click a mailto link with JQuery / JavaScript

I'd like to invoke a mailto link from JavaScript - that is I'd like a method that allows me to open the email client on the users PC, exactly as if they had clicked on a normal mailto link. How can I do this?
Justin
  • 80,106
  • 47
  • 208
  • 350
83
votes
4 answers

Automatically open default email client and pre-populate content

I need to automatically open a user's default email client when they save some content on a page. I need to populate the email subject, to address, and put some content in the email body. What is the best option to achieve this? I'm aware of the…
Thomas Buckley
  • 5,296
  • 16
  • 56
  • 106
67
votes
12 answers

How to show email addresses on the website to avoid spams?

I show email on my website as following Email But I read the following while analysing my website using woorank.com, what should I do to avoid this? Malicious bots scrape the web in search of email addresses…
Jack
  • 5,526
  • 22
  • 68
  • 141
61
votes
6 answers

mailto using javascript

I want to open a new outlook mail template with the 'To address' whenever a user clicks an image. I have return my code in a html page(linked with the image), whenever it loads the javascript should open a new mail template. But the functionality is…
Sathish
  • 659
  • 1
  • 6
  • 8
59
votes
8 answers

How to spamproof a mailto link?

I want visitors to be able to click on (or copy) an email address directly on my webpage. However, if I could make it (a little bit) harder for bots and other crawlers to get said email address and register it in a spam list, it would be awesome. I…
Wookai
  • 18,747
  • 16
  • 70
  • 85
45
votes
3 answers

Effective maximum mailto: body lengths

There is a maximum length for the text in the &body section of a mailto: link. According to one of my co-workers, the W3C publish the limit as 256 (I don't have a link to back this up, though). We're embedding mailto: links in both an e-mail and a…
40
votes
2 answers

How do I set up mailto for bcc only

I have a mailto link that I would like to populate the bcc only. Is that possible?
MrM
  • 20,601
  • 29
  • 103
  • 136
38
votes
2 answers

Register Windows program with the mailto protocol programmatically

How do I make it so mailto: links will be registered with my program? How would I then handle that event in my program? Most of the solutions I found from a quick Google search are how to do this manually, but I need to do this automatically for…
Liron Yahdav
  • 8,412
  • 7
  • 61
  • 90
1
2 3
69 70