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 Hussain5 min readA 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
What is a mailto link?
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:
| Field | Example | Use carefully because |
|---|---|---|
| to | mailto:hi@example.com | Visible to the sender |
| subject | ?subject=Demo%20request | Must be encoded |
| body | &body=Hello%0ASecond%20line | Some clients trim long bodies |
| cc | &cc=ops@example.com | May expose internal routing |
| bcc | &bcc=archive@example.com | Some 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.
When should you avoid mailto links?
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.
How should you make mailto links accessible?
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.
How do mailto links work in email templates?
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
mailtoopens 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
mailtofor simple contact actions.
Frequently asked questions
What is the HTML for a mailto link?
Use <a href="mailto:name@example.com">Email us</a>. Replace the address and anchor text with your own contact details.
How do I add a subject to a mailto link?
Add ?subject=Your%20subject after the address. Spaces and special characters should be percent-encoded.
Why does my mailto link not work?
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.
Related resources
Explore: Email Design & Content
Related Articles
HTML Email Basics: Examples, Structure, and Testing
HTML email is an email built with markup, inline styles, and layout patterns that email clients can render. It is not the same as a web page. Tables, fallbacks, accessibility, image handling, and client testing matter more than modern CSS tricks.
How to Create Email Templates That Convert
Email templates that convert share five traits: a single clear CTA, a hero section that answers 'why should I read this', one-column mobile-first layouts, preheader text that extends the subject line, and a scannable F-pattern body that respects how people actually read inboxes.
Understanding Email Headers: A Technical Guide
Email headers are the metadata that rides along with every message; they tell you where a mail came from, every server it touched, whether SPF, DKIM, and DMARC passed, and why a message got delayed, bounced, or flagged as spam.
AMP for Email: What It Is and How to Use It
AMP for email turns a static message into an interactive web app inside the inbox, letting subscribers submit forms, browse carousels, and update data without leaving Gmail. Support is limited to Gmail, Yahoo, and Mail.ru, so fallback HTML still matters.
Ready to supercharge your email marketing?
Start sending smarter emails with AI-powered campaigns. No credit card required.
Get Started Free