A mailto link is basically a HTML email link. It is similar to a regular web link but instead of using http:// it uses the mailto: command. Users can click on a mailto link in your website to send you an e-mail without first having to copy the destination e-mail address and open an e-mail client.
Generally speaking, mailto links are used to open the “new message” window of the user’s email client and auto populate the “To:” field of the new message with the address defined in the mailto link.
So, if you have Microsoft Outlook for example as your default mail client, pressing a mailto link will open Outlook’s “new mail” window.
Note: Your web browser requires a default e-mail client software (like Outlook) installed on your computer in order to activate the e-mail client.
Mailto Link Syntax And Examples
The basic mailto link looks like this:
<a href="mailto:firstname.lastname@example.org">Send email</a>
If you want the message to go to multiple email addresses, separate the email addresses with a comma:
<a href="mailto:email@example.com,firstname.lastname@example.org">Send email</a>
You can also use a number of additional variables to create more advanced mailto links. The variables you can use are:
- cc – Carbon copy. Address(es) to be included in the “cc” section of the message.
- bcc – Blind carbon copy. Address(es) to be included in the “bcc” section of the message.
- subject – To set the email subject line. 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.
- ? – First parameter delimiter
- & – Other parameters delimiter
Some more examples with the above variables:
Email link with a subject line:
<a href="mailto:email@example.com?subject=Email%20Subject">Send email</a>
Email link with a CC:
<a href="mailto:firstname.lastname@example.orgemail@example.com">Send email</a>
Email link with mutiple addresses in the CC:
<a href="mailto:firstname.lastname@example.orgemail@example.com,firstname.lastname@example.org">Send email</a>
Email link with a one line message body:
<a href="mailto:email@example.com?body=Just%20a%20dummy%20email%20message">Send email</a>
Email link with three lines of message body:
<a href="mailto:firstname.lastname@example.org?body=Just%20a%0Adummy%20email%0Amessage">Send email</a>
Email link with three lines of message body and a BCC:
<a href="mailto:email@example.comfirstname.lastname@example.org&body=Just%20a%0Adummy%20email%0Amessage">Send email</a>
Note: In the above examples, we have used a comma to separate multiple email addresses.
Some email clients might not be happy with this.
If you experience any issues with using a comma, use a semicolon “;” instead.
For your reference, here’s the official mailto protocol document:
The mailto URL scheme.
With Windows Internet Explorer 7 and later you must percent-encode all URL-reserved characters within a mailto: address. For example, the number sign (#) is used as a fragment identifier in URLs. When processing an address such as email@example.com, Internet Explorer copies only the portion up to the number sign into the mail client; the fragment portion including the number sign is ignored. This behavior is by design.
Issues With Mailto Links
While some people believe that a good mailto link is worth more than a thousand contact forms, it is important to also note that there are some issues associated with mailto links in general. In any case though, I still use mailto links (in addition to contact forms).
Mailto links may not always function correctly for the site visitor. As I earlier mentioned a default email client must be established on the computer. This must be a local program, typically using the SMTP protocol to send outbound mail. With the rise in use of webmail-based email, many computers lack local email client software. Alternatively, email client software may have been preinstalled by the computer vendor, but never used or configured. When such a visitor clicks on a mailto link in their web browser, either the browser will display an error to the effect that no default email client exists, or the user will be subjected to a volley of technical questions by the unconfigured email client. Many users are familiar with the Microsoft outlook screenshot below (or its 2010 equivalent).
This is not a desirable outcome. Some web browsers such as Opera, Firefox, and Chrome may be able to redirect clicks on mailto links to a chosen webmail service, but at the time of this writing, Internet Explorer as well as other browsers have no such capability.
This is a major reason why contact forms are so popular these days.
Security And Privacy
The greatest security or privacy concern with mailto links is that of robotic address harvesting. Mailto links can be located within HTML pages by automated means which typically include the use of DOM constructs or regular expressions. Addresses harvested by such means may be added to spammers’ mass-mailing lists, and to thus receive large amounts of unwanted mail.
A number of methods exist to ‘harden’ mailto links against harvesting. However, these methods are not guaranteed to remain effective if the technology of harvesting robots is improved. Therefore, there exists an argument for the deprecation of the mailto links in favor of contact forms. Contact forms however, experience similar challenges with preventing spam, which has led to the introduction of CAPTCHAs, ‘humanity checks’ and other anti-spam measures.
For now, I will continue using mailto links on this website in addition to my contact form.
Here’s a working example of a mailto link: Email me.
Note: This link works but unless you ask a question, I won’t reply. However, feel free to share your experience with mailto links in the comments section below.