How to Create a Mailto Link With a Subject and Body
Build a mailto link with subject, body, CC and BCC. Includes encoding rules and copy-ready examples.

A mailto link opens the visitor's email app with a message already started. You can fill in the address, subject, and even the body. It takes one line of HTML.
This guide shows how to build a mailto link, how to encode special characters, and where it goes wrong. You will also find copy-ready examples.
What a mailto link is#
A mailto link is a normal web link that starts with mailto: instead of https:. When someone clicks it, the browser hands the job to their default email app. The format is defined in RFC 6068.
The basic form looks like this:
<a href="mailto:hello@example.com">Email us</a>
Clicking opens a new message addressed to hello@example.com.
Add a subject and body#
Add a question mark after the address. Then add fields as name=value pairs, joined by ampersands.
<a href="mailto:hello@example.com?subject=Demo%20request&body=Hi%20team%2C%0D%0A%0D%0AI%27d%20like%20a%20demo.">Request a demo</a>
This sets the subject to "Demo request" and fills in a short body. The visitor can still edit the message before sending.
The fields you can use#
| Field | What it does | Example |
|---|---|---|
| to | The recipient, placed right after mailto: |
mailto:sales@example.com |
| cc | Copy another person | cc=ops@example.com |
| bcc | Blind copy | bcc=archive@example.com |
| subject | The subject line | subject=Pricing%20question |
| body | The message text | body=Hello |
Use a comma between addresses to send to several people, for example mailto:a@example.com,b@example.com.
Encoding rules#
A mailto link is a URL, so you have to encode special characters. The most common ones:
- Space:
%20. The RFC warns that using+for a space is ambiguous, so avoid it. - Line break in the body:
%0D%0A. - Comma:
%2C, inside values. - Question mark:
%3F - Ampersand:
%26 - Equals sign:
%3D - Hash:
%23
Skip encoding and your link may cut off at the first & or #. The message will look broken.
In JavaScript, encodeURIComponent() does this for you:
const subject = encodeURIComponent('Demo request')
const body = encodeURIComponent('Hi team,\n\nI would like a demo.')
const href = `mailto:hello@example.com?subject=${subject}&body=${body}`
Note that encodeURIComponent turns a line break into %0A. Most mail apps handle that, but %0D%0A is the form the RFC specifies.
Copy-ready examples#
Contact us#
<a href="mailto:hello@example.com?subject=Question%20from%20your%20website">Contact us</a>
Sales inquiry with a template body#
<a href="mailto:sales@example.com?subject=Pricing%20question&body=Company%3A%0D%0ATeam%20size%3A%0D%0AQuestion%3A">Ask about pricing</a>
Share a page with a friend#
<a href="mailto:?subject=Worth%20a%20read&body=https%3A%2F%2Fexample.com%2Farticle">Share by email</a>
The address can be empty. The reader picks who to send it to.
Add a copy for your team#
<a href="mailto:support@example.com?cc=success@example.com&subject=Help">Get help</a>
When to use a mailto link#
A mailto link suits simple cases. It works well for a contact line in a footer, a share button, or a support address in a help page. For anything that needs a record of the request, such as a lead form, use a real form instead. A form lets you store the message, route it, and reply from your own system.
Limits and gotchas#
- It needs an email app. On a computer with no default mail app, nothing happens, or the system asks the user to choose one. Always show the address as text too.
- Length limits. Browsers and apps cap URL length. Keep the body short.
- Plain text only. You cannot send formatted HTML or attachments through a mailto link.
- BCC is not private. The RFC warns that BCC addresses sit in the URL. Anyone can read them in the page source.
- Mobile behavior varies. Some phones open the Mail app, others open Gmail. Test both.
Spam and privacy#
Putting a plain address on a web page invites scrapers. Bots crawl pages looking for mailto: links. Spam can follow.
Ways to lower the risk:
- Use a shared address, such as hello@, that is behind a spam filter.
- Use a contact form where a form fits better.
- Build the link with JavaScript when the page loads, so it is not in the raw HTML.
- Never put a personal address on a public page.
Whatever you choose, keep your sender setup in order. Our free spam checker can test a message before you send replies at scale.
Make it easy with a generator#
Hand-encoding gets tedious. The free mailto link generator builds the link from a form. Type the address, subject, and body, and it returns the encoded code.
You can also write better subject lines with the email subject line generator. For a ready message to drop into the body, see the email templates tool.
Accessibility tips#
- Write link text that says what happens, such as "Email our sales team".
- Avoid link text like "Click here".
- Put the address in the text for people who copy it.
- Do not use a mailto link as the only way to reach you.
Frequently asked questions#
How do I add a subject to a mailto link?#
Add ?subject= after the address, and encode spaces as %20. Example: mailto:hi@example.com?subject=Hello%20there.
How do I add more than one field?#
Join them with &. For example: ?subject=Hi&cc=a@example.com.
How do I add a line break in the body?#
Use %0D%0A in the body text.
Can a mailto link attach a file?#
No. The standard does not support attachments in mailto links.
Why does my mailto link do nothing?#
The device probably has no default email app, or the link has a typo. Check encoding, and show the plain address as a backup.
The takeaway#
A mailto link is quick to add and easy to get wrong. Encode your values, keep the body short, and show the address as text too. Use a generator to avoid typos.
Build your first one now with the free Tomba mailto link generator.
// start free
See who Tomba finds at any company
Type a company's domain to see its people, their roles and verified work emails, each with the pages it was found on. Free account, no card.
Free plan · No credit card required · GDPR & CCPA