Why mailto Links Behave Differently—and How to Test Them

Troubleshoot a mailto link not working in an email client. Learn about handler settings, encoding subject and body fields, testing, and fallbacks.

Published
Reading time
6 min read
Why mailto Links Behave Differently—and How to Test Them
On this page

A mailto: link can be valid HTML and still seem broken: clicking it depends on the browser, device, and configured email handler. Here’s how to troubleshoot the difference, encode subject and body values safely, and test a contact link without assuming every visitor uses the same setup.

Key Takeaways

  • A mailto: link asks the user’s environment to open a compose window; it does not send an email by itself.
  • The browser or operating system’s email-handler configuration can affect what opens—or whether anything opens.
  • Percent-encode reserved characters in subject and body values, and use %0D%0A for line breaks.
  • Test on representative devices and browsers, and provide a fallback contact method.
  • Use descriptive link text so people can tell what the link does.

A mailto: link uses a URI scheme for email addresses and optional message fields. When someone activates it, their browser or device tries to hand the request to an email handler. That handler might be a desktop mail application, a webmail service registered with the browser, or a mobile email app.

The setup belongs to the recipient, not the website. A visitor might have no handler configured, use a different default app, or be on a managed device with restrictions. Some environments show a prompt; others switch to a compose window. A page cannot reliably select the same email client for everyone or force a message to send.

So “mailto link not working in email client” can describe several different problems: nothing happens, the wrong app opens, or the compose window appears without the expected subject or body. First identify which outcome occurs and on which device and browser.

Use a real address and test the simplest form before adding optional fields:

<a href="mailto:hello@example.com">Email our team</a>

Replace hello@example.com with an address you control. Clicking the link should request a new message addressed to that recipient, provided the environment has a working handler. If nothing happens, try another browser or device. If the link works elsewhere, the problem is likely the original environment’s handler configuration rather than the HTML alone.

Advertisement

Encode subject and body values

To prefill a subject or body, add query parameters to the mailto: URI. Encode the values, not the entire link. Reserved characters such as &, ?, and # can change how the URI is parsed if they appear unencoded inside a value. Spaces and non-ASCII characters also need appropriate percent encoding.

For example, this link sets a subject containing an ampersand and question mark, then adds a two-line body:

<a href="mailto:hello@example.com?subject=Question%20%26%20feedback%3F&amp;body=Hello%2C%0D%0AI%27d%20like%20to%20ask%20about%20your%20service.">
  Email our team about a question
</a>

In HTML, write the separator between query parameters as &amp;. The browser parses that HTML entity as & in the URI. In the body value, %0D%0A represents a CRLF line break. Encode a literal ampersand as %26, a question mark as %3F, and a number sign as %23 when those characters are part of a value. For text containing non-ASCII characters, percent-encode its UTF-8 bytes.

Keep the prefilled message short and optional. A large body can be awkward on mobile, and some handlers may display or interpret fields differently. Do not put private information into a prefilled message: the visitor can review and edit it, and the link itself is visible in the page source.

Test a small, representative set

Test the actual page—not just a copied URI—in a small matrix of environments your audience is likely to use. For each test, record the device, operating system, browser, configured email handler, and result. Check whether the compose window opens, the recipient is correct, and the subject and line breaks appear as intended.

Test caseWhat to check
Basic address-only linkDoes a compose window open with the expected recipient?
Encoded subject and bodyAre punctuation and line breaks preserved?
Desktop browser with a configured handlerDoes the expected desktop app or registered webmail handler open?
Mobile browserDoes the device hand off to an available email app?
Environment with no configured handler, if availableIs the failure understandable, and can the visitor still contact you?

This is a test plan, not a report of live compatibility testing: I could not run these checks across real devices or email clients while preparing this article. Record the versions and configuration used when you do test; handler behavior can change with device settings and browser updates. For a useful baseline, test one desktop environment and one mobile environment, then add the browsers and devices that matter most to your audience.

Advertisement

Troubleshoot by symptom

  • Nothing happens: Check whether the device has an email handler configured. Test another mailto: link and another browser to separate a handler issue from a problem in your page.
  • The wrong app opens: The visitor’s browser or operating system may have a different default handler. Your page generally cannot override that preference; explain how to use the fallback contact method instead.
  • The recipient, subject, or body is wrong: Inspect the rendered href in the browser’s developer tools. Check for unencoded reserved characters, missing query separators, or a value that was encoded twice.
  • The link works on desktop but not mobile: Verify that a compatible email app is available and that the mobile browser can hand off the link. Do not assume the desktop browser’s handler settings apply on a phone.
  • A body line break is missing: Use encoded CRLF (%0D%0A) and check the result in more than one handler. The recipient’s email application controls how the compose window displays the body.

Common Mistakes

  • Treating a successful click as proof an email was sent. The link only requests a compose action. The user still has to review and send the message.
  • Leaving reserved characters unencoded. An unescaped & can start another parameter, while ? and # can affect URI parsing.
  • Encoding the whole URI as one value. Keep the mailto: scheme, address, and parameter separators intact; encode individual parameter values.
  • Assuming one test represents everyone. A working link on one browser says little about a visitor’s default handler or device.
  • Using vague link text. “Click here” does not tell a visitor that the link opens an email compose window.
  • Offering no alternative. A visitor may not have an email handler available or may prefer not to use one.

Best Practices

  • Use concise, descriptive link text such as “Email our support team.”
  • Make the address visible or otherwise easy to copy when that suits the page.
  • Provide another contact option, such as a contact form or a clearly displayed email address. Keep that fallback usable without JavaScript where practical.
  • Test the rendered page on representative desktop and mobile setups, including the encoded fields you actually use.
  • Keep prefilled content brief, non-sensitive, and easy for the visitor to edit.
  • Document the test environment and retest after meaningful page or platform changes.

Conclusion

A mailto: link depends on the visitor’s email-handler setup, so its behavior will not be identical everywhere. Keep the URI simple, encode optional values correctly, test representative environments, and offer a clear alternative contact method.

References

What would your domain sell for?

A free TidyURLs account unlocks the Domain Estimator. It prices a name from 191,011 real domain sales.