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.
1116 questions
18
votes
4 answers

Getting around mailto / href / url character limit

I have a mailto link in an anchor tag Email This The issue is that the Body parameter is a huge article, and there appears to be a character limit on the url. Is there a way to get around the limit?
HyderA
  • 20,651
  • 42
  • 112
  • 180
17
votes
4 answers

Should mailto be used in HTML5?

A year or so ago I decided to stop using the mailto tag because many times it is annoying to the user. It will bring up an email program that the user may not be using at the time, which may also take time to load and may not be what the user wanted…
Metropolis
  • 6,542
  • 19
  • 56
  • 86
17
votes
3 answers

How to (correctly) create mailto URL (URI) in Java?

Given: String email1 = "simple@example.org"; // legal email address according to wikipedia [1] String email2 = "\"()<>[]:,;@\\\"!#$%&'*+-/=?^_`{}| ~.a\"@example.org"; What is the best/correct way to create a mailto: URI (in the form of a String…
David Balažic
  • 1,319
  • 1
  • 23
  • 50
16
votes
4 answers

How to pass an URL in mailto's body

I need to send an URL of my site in the body so the mail recipient can click on that to join my site. However currently mail client renders the mail like this: Link goes here http://www.example.com/foo.php?this=a The URL is truncated on the &…
16
votes
3 answers

Trying to add mailto - react native

Mailto appears to not be working. All that happens is that the icon appears to be pressed, but no action occurs. Shoots out this warning: Warning Code
user2026178
  • 308
  • 2
  • 4
  • 21
16
votes
3 answers

Href and mailto links in KnockoutJS

I'm trying to display a table with links and mailto's in a display template using Knockout. I'm still really new to knock out to I apologize in advance! This is what my display template was originally: