How to Create a Mailto Link for a Website

Woman using email on her tablet
PeopleImages/Getty Images

Every website has a "win" — the intended action that a site visitor undertakes. Most websites support several possible wins. For example, a site may allow you to sign up for an email newsletter, register for an event, or download a whitepaper. Email offers a low-friction way of building a connection, so a mailto link on your site makes for a great general-purpose win.

Mailto links are links on web pages that point to an email address. When a website visitor clicks on one of these mailto links, the default email client on that person's computer opens and they can send a message to that email address specified in the mailto link. For many users with Windows, these links will pop open Outlook and have an email all ready to go based on the criteria you have added to the "mailto" link.

These email links are a great way to provide a contact option on your website, but they do come with some challenges.

How to Create a Mailto Link

To create a link on your website that opens an email window, use a mailto link. For example:

<a href="mailto:webdesign@example.com">Send me an email</a> 

To send email to more than one address, simply separate the email addresses with a comma. In addition to the address that should receive this email, you can also set up your mail link with a CC, BCC, and subject line. Add those optional items to the link by separating them with a question mark.

To avoid potential errors in your HTML, use %20 instead of a space. For example, the string test email should be represented as test%20mail.

For example, to specify an email that's sent to two addresses and CC'd to one address, and which specifies a subject line, use the following link:

<a href="mailto:acct1@example.com,acct2@example.com?cc=acct3@example.com?subject=test%20email">send us a message</a>

The Downside of Mailto Links

As easy as these links are to add, and as helpful as they can be for many users, there are also downsides to this approach. Many spam programs crawl websites harvesting email addresses to use in their spam campaigns or to perhaps sell to others who will use these emails in this fashion.

Even if you don’t get a lot of spam, or have a good spam filter to try to block this type of unsolicited and unwanted communication, you might still get more email than you can handle. To help prevent this from happening, consider using a web form on your site instead of a mailto link.

Using Forms

Consider using a web form in place of a mailto link. Those forms can also give you the ability to do more with these communications since you can ask specific questions in a way that a mailto link does not allow for. With the answers to your questions, you may be able to better sort through email submissions and respond to those inquiries in a more informed manner.

In addition to being able to ask more question, using a form also has the advantage of not (always) printing an email address on the web page for spammers to harvest.