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 Hussain(Updated: )4 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 prefill subject, body, cc, and bcc as well, provided those fields are encoded properly.

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: it's a link format, not a sending API.

A mailto link is a URI that asks the user's mail client to start a new message. It does not send the email, store it, validate the address, or protect against anything. The browser hands the request to whatever email handler the user has configured, and what happens next is out of your control.

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

Strictly speaking mailto is a URI scheme rather than a URL. People call it a URL because it lives in an href, but it doesn't locate a web resource; it identifies an email composition action. That's why there's no // and no domain path after the protocol.

The distinction matters when developers try to track it. Analytics can see the click on the link and nothing after that: not whether the mail app opened, not whether the sender typed a word, not whether the message was ever sent. If you need attribution, you need a form.

Adding subject, body, cc, and bcc

Add query parameters after the address. The first starts with ?; every one after that starts with &. Spaces, line breaks, ampersands, and special characters all 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>
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 requires characters outside the URI-safe set to be percent-encoded. The most common bug by a distance is writing raw spaces into the URL; it works in one browser and breaks in another, which makes it the kind of bug that ships.

When to use a form instead

Avoid mailto when the email action is business critical. A visitor on a shared computer, or with no default mail app, or using webmail without a registered handler, or clicking from inside an app's built-in browser, may get nothing at all. Browsers can register protocol handlers for schemes like mailto (MDN protocol handlers), so behavior varies by browser, device, and account settings in ways you cannot test exhaustively.

Use a form when you need required fields, file uploads, CRM routing, spam protection, ticket numbers, attribution, or a guaranteed confirmation state. Use mailto when the cost of failure is low and the action is obviously "send us an email"; on a legal page, a security contact, or a personal founder note, it's usually enough.

When a mailto link doesn't work at all, the cause is nearly always one of three things: no default client configured on the user's machine, a browser blocking the handler, or unencoded characters in the URL. Test the third one yourself on desktop and mobile before you publish, because it's the only one you can fix.

Make the anchor text describe the action and the destination. MDN describes <a> as the element for linking to pages, files, email addresses, and locations (MDN anchor element); that flexibility puts the entire burden on your link text.

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

Compare those with Click here and Contact, which tell a screen reader user nothing about where the link goes or what it will open. Signature blocks have the same problem and repeat it across every message you send; our email signature generator handles the markup if you'd rather not hand-write it.

They work in email, and they need the same encoding discipline as a web page. Test in Gmail, Outlook, Apple Mail, and at least two mobile clients. Some clients alter long URLs and others rewrite links for click tracking, either of which will mangle a long prefilled body.

Keep them short:

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

For campaign CTAs, send people to a landing page instead. You can track the click, prefill a form with UTM data, and route the response somewhere a human will see it; our guide to email templates that convert covers CTA structure, and HTML email basics covers the markup around it. For pre-send QA, run the message through the responsive email tester and the email accessibility checker.

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