Technical

Mailto Link HTML Guide: Syntax, Examples, and Pitfalls

A mailto link opens the user's email client with a prefilled recipient, subject, body, cc, or bcc field. It is useful for simple contact actions, but it is not a form replacement. This guide shows the exact HTML syntax, encoding rules, and mistakes to avoid.

Sohail HussainSohail Hussain5 min read

A mailto link is an HTML link that opens the visitor's default email app instead of a web page. The simplest version is <a href="mailto:hi@example.com">Email us</a>. You can also prefill subject, body, cc, and bcc, but those fields must be encoded safely.

The format is defined by RFC 6068, which describes mailto as a URI scheme for resources reached through internet mail (RFC 6068). In plain English: mailto: is a link format, not a message-sending API.

Table of contents

A mailto link is a URI that asks the user's mail client to start a new message. It does not send the email by itself, store the message, validate the address, protect against spam, or work consistently on every device. The browser hands the request to whatever email handler the user has configured.

Basic syntax:

<a href="mailto:hi@example.com">Email hi@example.com</a>

The link is best for direct human contact, support addresses, sales inquiries, and personal email actions. It is a poor fit for lead capture, support ticket routing, or any workflow where you must guarantee the message was submitted.

How do you add subject and body text?

Add query parameters after the address. The first parameter starts with ?; every later parameter starts with &. Spaces, line breaks, ampersands, and special characters need percent encoding.

<a href="mailto:hi@example.com?subject=Demo%20request&body=Hi%20Mailneo%2C%0A%0AI%27d%20like%20to%20book%20a%20demo.">
  Request a demo
</a>

Common fields:

FieldExampleUse carefully because
tomailto:hi@example.comVisible to the sender
subject?subject=Demo%20requestMust be encoded
body&body=Hello%0ASecond%20lineSome clients trim long bodies
cc&cc=ops@example.comMay expose internal routing
bcc&bcc=archive@example.comSome clients ignore it

RFC 6068 warns that characters outside the URI-safe set must be percent-encoded. The most common bug is writing spaces directly into the URL. It may work in one browser and break in another.

Is mailto a URL or a URI?

mailto is a URI scheme. People often call it a URL in everyday conversation because it appears in an href, but it does not locate a web resource. It identifies an email composition action. That is why mailto:hi@example.com has no // and no domain path after a protocol.

That distinction matters when developers try to track it. A normal analytics script sees a click on the link, not whether the email app opened, whether the sender typed anything, or whether the message was sent. If you need attribution, use a contact form or a tracked support intake flow.

Avoid mailto when the email action is business critical. If the visitor is on a shared computer, has no default mail app, uses webmail without a handler, or clicks from an in-app browser, the link may do nothing useful.

Use a form instead when you need:

  • Required fields.
  • File uploads.
  • CRM routing.
  • Spam protection.
  • Ticket numbers.
  • Attribution.
  • A guaranteed confirmation state.

Use mailto when the cost of failure is low and the action is clearly "send us an email." On a legal page, a security contact, or a personal founder note, it is often enough.

Make the anchor text describe the action and destination. "Email support" is better than "click here." MDN describes the <a> element as the hyperlink element for web pages, files, email addresses, page locations, and anything else a URL can address (MDN anchor element). That flexibility is useful, but it puts the burden on the link text.

Good examples:

<a href="mailto:support@example.com">Email support</a>
<a href="mailto:security@example.com">Report a security issue</a>

Weak examples:

<a href="mailto:support@example.com">Click here</a>
<a href="mailto:security@example.com">Contact</a>

Also remember that browsers can register handlers for protocols such as mailto. MDN's registerProtocolHandler() documentation uses mailto as an example of a non-HTTPS protocol that can be routed to a chosen app or webmail handler (MDN protocol handlers). That means user behavior can vary by browser, device, and account settings.

Mailto links work inside HTML emails, but they need the same encoding discipline as web pages. Test them in Gmail, Outlook, Apple Mail, and mobile clients. Some clients alter long URLs; others rewrite links for tracking. That can mangle a long prefilled body.

Keep email-template mailto links short:

<a href="mailto:support@example.com?subject=Question%20about%20my%20account">
  Contact support
</a>

For campaign CTAs, use a landing page instead. You can track the click, prefill a form with UTM data, and route the response cleanly. For template QA, run the message through our responsive email tester and email accessibility checker.

Key takeaways

  • mailto opens an email client; it does not send email.
  • Encode subjects, bodies, and line breaks before putting them in an href.
  • Use forms for critical workflows and mailto for simple contact actions.

Frequently asked questions

Use <a href="mailto:name@example.com">Email us</a>. Replace the address and anchor text with your own contact details.

Add ?subject=Your%20subject after the address. Spaces and special characters should be percent-encoded.

The user may not have a default email client configured, the browser may block the handler, or the URL may contain unencoded characters. Test on desktop and mobile before publishing.

mailtohtml-emailemail-linkstechnical
Share this article
Sohail Hussain

Sohail Hussain

Founder & CEO at Mailneo

Building Mailneo — AI-powered email marketing for growing businesses.

Ready to supercharge your email marketing?

Start sending smarter emails with AI-powered campaigns. No credit card required.

Get Started Free