W3docs

How to Create Mailto Links

Learn about how to create a Mailto link in HTML step by step with examples. See also the downsides that Mailto links can have.

Mailto links are used to redirect to an email address instead of a web page URL. When a user clicks on the Mailto link, the default email client on the visitor's computer opens and suggests sending a message to the email address mentioned in the Mailto link.

To create a Mailto link, you need to use the HTML <a> tag with its <span class="attribute">href</span> attribute, and insert a "mailto:" parameter after it, like the following:

How to create mailto links using mailto parameter

<a href="mailto:[email protected]">Send Email</a>

<div>Demo: Send Email</div> If you want to receive the email to more than one address, separate your email addresses with a comma:

How to create mailto links for more than one address

<a href="mailto:[email protected],[email protected]">Send Email</a>

<div>Demo: Send Email</div>

The following fields can be filled out beforehand:

  • subject - for the subject line,
  • cc - for sending a carbon copy,
  • bcc - for sending a blind carbon copy,
  • body - for the message's body text.

If you want to have a subject field, which is already filled out, add the “subject” parameter to the <span class="attribute">href</span> attribute:

How to create mailto links with subject parameter

<a href="mailto:[email protected]?subject=Mail%20from%20our%20Website">Send Email</a>

<div>Demo: Send Email</div> To add CC and BCC to your email, use the "cc" or "bcc" parameter on the <span class="attribute">href</span> attribute:

How to create mailto links with cc or bcc parameters

<a href="mailto:[email protected][email protected],[email protected]&[email protected]&subject=Mail%20from%20our%20Website">Send Email</a>

<div>Demo: Send Email</div> To add a body text, use the "body" parameter with other parameters:

How to create mailto links with body parameter

<a href="mailto:[email protected][email protected],[email protected]&[email protected]&subject=Mail%20from%20our%20Website&body=Some%20body%20text%20here">Send Email</a>

<div>Demo: Send Email</div> Putting all together, we'll have the following example.

Using Mailto links is quite easy and helpful, but it also has downsides for many users. Mailto links can expose your email address to scrapers, leading to increased spam emails. Spammers often harvest these links to build mailing lists.

Even if you don’t receive many spams, or have a good spam filter, you cannot escape from spam emails. It's better to use a Mailto form on your website instead of a Mailto link.