Mailto Links Explained

Mailto not working right? Chances are, you’re making a simple mistake that is causing your link to not open your default email client. Understanding a little about mailto link can also help. The link, placed inside of the <a> tag – like this <a href="email@example.com">mail me</a> – is used inside of HTML to open an email client with the email address inside of the tag.

If you add commas, you can send the same email to multiple recipients.

If you want to customize your mailto links, you can. But each new addition to your link adds another opportunity to make a mistake. A missing comma or quotation mark can cause an error, but there’s a problem: you should pre-populate as much information as possible so that the sender doesn’t have to fill in additional information.

A few of the key customization options, which are added inside of the same <a> tag that the mailto link exists, are:

  • Subject: Add subject=Name%20of%20subject%20goes%20here
  • Body: Add body=text%20inside%20of%body
  • CC and BCC: You can cc someone or bcc someone using the following cc=me@example.com&bcc=me2@example.com

Each customizaion must be added using the query parameter url encoded style. When you need to make spaces, be sure to use %20 to indicate a space rather than using a space that will break the coding. Keep in mind that ? goes before the first customization parameter and & goes before subsequent customization parameters.

A full example may look something like this:

<a href="mailto:test@example.com?cc=me@example.com&bcc=me2@example.com&subject=Name%20of%20subject%20goes%20here&body=text%20inside%20of%body">Example link</a>

If you want to open the mailto link in a new window, you can add in target=blank which is recommended to add to your user experience. Small mistakes in your syntax can lead to your mailto not working properly.

If your mailto link isn’t working still, the fix is likely easy. Usage is simple, so the most common issues you’ll come across are:

  • Email addresses not typed out properly
  • Field input is incorrect
  • Default clients aren’t working properly

When the default email client won’t open properly, it’s an issue on the user’s end. The user will need to set the appropriate client as their default. For example, they may use Gmail but never setup their Outlook, so Outlook opens.

The user would need to change the default client based on their operating system, whether it be Windows, Mac, iOS, Android, Linux or others. Otherwise, if you’re still having issues with mailto link not working, you’ll want to go through your HTML and ensure:

  • Syntax is correct
  • You have the right email and other data in place
  • You’re not missing a quotation mark or comma

Oftentimes, skimming through your coding when you have an issue with mailto not working is all you need to correct the issue. You may also want to reconsider your approach. While mailto still works well, contact forms can help stop bots from harvesting your email address, can include a variety of fields, and there are a lot of free and paid form builders available. From a user standpoint, it’s easier to fill in a contact form, and it will also allow you to retrieve more information from the sender.