If you are trying to implement or troubleshoot a , the most important thing to understand is this:
opens a draft in the user's default email app- it does not send email on its own
That distinction explains most of the bugs people run into. A mailto link is a client handoff, not a sending system, not a workflow engine, and not a reliable support intake channel.
Quick answer
Use a mailto link when you want the user to open their own mail client with a recipient, subject, or body prefilled.
Do not use mailto when you need:
- guaranteed delivery
- tracking or analytics
- support-ticket capture
- attachments or structured submissions
- QA or release automation
If the business cares whether the message was actually sent, mailto is usually the wrong tool.
What is a mailto link?
A mailto link is a URL scheme that tells the browser or operating system to open the default mail application.
The smallest working form looks like this:
When the user clicks it, their environment decides what happens next:
- Apple Mail on macOS
- Outlook on Windows
- Gmail or another configured app on mobile
- sometimes nothing useful at all if no default mail client is configured
That is why mailto behavior is inconsistent across devices even when your HTML is correct.
Mailto syntax template
The general syntax is:
The common fields are:
| Parameter | What it does |
|---|---|
| sets the main recipient |
| prefills the subject line |
| prefills the message body |
| prefills cc recipients |
| prefills bcc recipients |
You use before the first parameter and for each additional parameter.
Mailto HTML examples
Simple contact link
Mailto link with subject line
Mailto link with subject and body
Mailto link with cc and bcc
Multiple recipients
Multiple recipients can behave differently across clients, so test this on the devices your audience actually uses.
How to build a mailto link in JavaScript
If any values are dynamic, generate the URL in code and encode each field.
This is safer than stitching strings together by hand because it prevents broken subjects, malformed bodies, and accidental query-string parsing issues.
Mailto parameters and encoding rules
Most mailto bugs are encoding bugs.
Spaces
Encode spaces as .
Line breaks
Encode line breaks so the mail body opens correctly.
Special characters
Characters like , , , and can break the URL if they are not encoded.
The safest pattern is:
- keep raw content in normal strings
- use
on every dynamic value - only then build the final URL
How to test a mailto link
People search for for a reason: the link may be syntactically correct and still fail for real users.
Test mailto on:
- desktop browsers you support
- iPhone and Android flows if mobile matters
- devices where Outlook, Apple Mail, and Gmail are common defaults
- machines with no default mail client set
Check these failure modes:
- nothing opens
- the wrong mail app opens
- subject or body fields are malformed
- line breaks disappear
- cc or bcc fields are ignored
- long message bodies are truncated or behave inconsistently
If the path matters to conversion or support resolution, provide a visible fallback such as:
- a plain contact email address
- a contact form
- a support portal
Mailto link builder vs generating in code
Searchers also look for a .
A builder can be fine when:
- you only need a static contact link
- a marketer or content editor wants a one-off URL
- the values rarely change
Generating the URL in code is better when:
- subject lines depend on the page or workflow
- you pass case numbers, order IDs, or locale-specific content
- multiple components need the same mailto behavior
- you want tests around the final URL generation
Common mailto problems and fixes
The link does nothing
Likely cause:
- no default mail app is configured
Fix:
- expose the destination email address visibly
- provide a form fallback on critical paths
The subject or body looks broken
Likely cause:
- missing URL encoding
Fix:
- encode every dynamic value
- test values with punctuation, spaces, and new lines
Mobile behavior is inconsistent
Likely cause:
- the device handles mail intents differently from desktop
Fix:
- test on real devices
- keep mobile mailto bodies short
The link is too long
Likely cause:
- too much body text or too many parameters
Fix:
- keep mailto short
- move richer context into a form or app flow
The team expects attachments or structured intake
Likely cause:
- treating mailto as a workflow system
Fix:
- use a proper form, support flow, or backend API instead
Accessibility and UX tips
If you do use mailto, make the experience clearer:
- label the action clearly, for example
- show the fallback email address near the CTA
- avoid hiding critical support paths behind mailto only
- make it obvious an external mail app will open
- do not dump long, hard-to-edit template text into the body
For important customer-facing flows, the safest pattern is usually:
- a form for reliable capture
- a visible support or sales email address as a backup
When mailto is a good fit
Mailto is a good fit when the user is expected to draft and send the email themselves.
Good examples:
- simple contact links
- sales inquiries
- feedback prompts
- "email us" links in footers, help pages, and account settings
In these cases, the goal is to help the user start an email, not to guarantee a business workflow.
When to use something other than mailto
Do not rely on mailto for:
- password reset
- OTP or MFA delivery
- signup verification
- support intake that must be captured
- attachment-heavy workflows
- any message path that needs retries, tracking, or observability
If your system must send the message, use email infrastructure instead of a client handoff.
Practical alternatives:
How MailSlurp helps
MailSlurp is built for teams that start with "we only need a simple email path" and later need:
- inboxes they can provision in code
- deterministic checks for links, codes, and message content
- webhooks and routing for downstream systems
- proof that message workflows pass before release
That is the point where mailto stops being enough and email becomes part of the product workflow.
If you need to test or automate those flows, start with Email integration testing or create a free account at app.mailslurp.com.
FAQ
What does a mailto link do?
A mailto link opens the user's default email client and prefills fields such as recipient, subject, and body.
Can a mailto link send email automatically?
No. It opens a draft. The user and their email client still control whether the message is sent.
What is the correct mailto syntax?
The basic syntax is . Use for additional parameters such as and .
Why is my mailto link body not formatting correctly?
The usual cause is missing URL encoding for spaces, punctuation, or line breaks.
Can a mailto link include attachments?
Not reliably. Attachments depend on the user's local client flow and should not be treated as a dependable implementation pattern.
Should I use a mailto link builder?
Use a builder for simple static links. Generate the URL in code when the fields are dynamic or reused in multiple workflows.
What should I use instead of mailto for app email workflows?
Use an email API, a form, or inbox testing tools when you need reliability, observability, or automation.
Final take
A mailto link is useful for lightweight user-initiated contact. It is not a delivery system and it is not a safe substitute for backend email infrastructure. If the message path matters to support, conversion, or product reliability, treat email like infrastructure instead of a browser handoff.



