MailSlurp logo

blog

HTML mailto link syntax, examples, subject, body, CC, and BCC

Build reliable HTML mailto links with correct syntax, subject and body parameters, URL encoding, CC, BCC, examples, and fallback testing guidance.

If you searched for "mailto html", "html mailto link", or "mailto parameters", this page is the implementation playbook. Refer to Mailto link guide: syntax, HTML examples and fixes for broader strategy and UX advice; here we focus on how to author the anchor and query string that each browser actually respects.

The sections below cover exact syntax, URL encoding rules, and HTML tricks that keep the mailto anchor working across clients.

A mailto link is an anchor tag with an href that starts with mailto:. When users click it, their default email client opens with pre-filled fields.

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

Mailto is useful for lightweight contact actions, but it is not a full email-delivery system.

HTML mailto syntax cheat sheet

Goal HTML
Basic recipient <a href="mailto:support@example.com">Email support</a>
Subject <a href="mailto:support@example.com?subject=Support%20request">Email support</a>
Subject and body <a href="mailto:support@example.com?subject=Bug&body=Steps%3A%0A">Report bug</a>
CC <a href="mailto:support@example.com?cc=ops@example.com">Email support</a>
BCC <a href="mailto:support@example.com?bcc=audit@example.com">Email support</a>
Multiple recipients <a href="mailto:help@example.com,ops@example.com">Escalate</a>

The syntax is simple, but the values after ? must be URL-encoded.

Mailto HTML code pattern

Use this base pattern when you need the shortest working HTML mailto link:

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

Use this pattern when you need a subject and body:

<a href="mailto:hello@example.com?subject=Website%20question&body=Hi%20team%2C%0A">
  Email us
</a>

Always encode spaces, line breaks, ampersands, question marks, and other special characters inside parameters.

Mailto syntax basics

General pattern:

mailto:recipient@example.com?subject=...&body=...&cc=...&bcc=...

Rules:

  • use ? before the first parameter
  • use & between additional parameters
  • URL-encode values (%20 for spaces)
  • keep parameters lowercase for consistency

Common mailto parameters

Parameter Purpose Example
subject pre-fills email subject subject=Support%20request
body pre-fills body text body=Hi%20team%2C%20I%20need%20help
cc visible copy recipient cc=ops@example.com
bcc hidden copy recipient bcc=audit@example.com

Example with multiple fields:

<a
  href="mailto:support@example.com?subject=Billing%20question&body=Account%20ID%3A%2012345&cc=team@example.com"
>
  Contact billing
</a>

Mailto subject and body examples

Support request

<a
  href="mailto:support@example.com?subject=Support%20request&body=Hi%20team%2C%0A%0AMy%20account%20ID%20is%3A%20"
>
  Contact support
</a>

Sales inquiry

<a
  href="mailto:sales@example.com?subject=Demo%20request&body=Hi%2C%20I%20would%20like%20to%20book%20a%20demo."
>
  Request demo
</a>

Bug report

<a
  href="mailto:bugs@example.com?subject=Bug%20report&body=Expected%3A%0AActual%3A%0ASteps%20to%20reproduce%3A"
>
  Report a bug
</a>

Keep body templates short. Long mailto: URLs are harder to read, easier to break, and can behave inconsistently across clients.

How to encode mailto values correctly

Most mailto bugs come from bad encoding.

Use:

  • %20 for spaces
  • %0A for new lines
  • %26 for literal &
  • %3F for literal ?

Example with line breaks:

<a
  href="mailto:support@example.com?subject=Bug%20report&body=Steps%20to%20reproduce%3A%0A1.%20Open%20app%0A2.%20Click%20checkout"
>
  Report issue
</a>

Multiple recipients with mailto

You can add multiple recipients separated by commas:

<a href="mailto:help@example.com,ops@example.com?subject=Escalation">Escalate</a>

Keep recipient lists short. Long links can break in some clients.

Can mailto include attachments?

Not reliably.

There is no consistent cross-client standard for attaching local files via mailto links. If attachments are required, use:

  • a file upload form
  • API-based sending workflows

Related: Email attachments API and attachments guide.

Common failure points:

  • no default email client configured
  • mobile app/browser mismatch
  • malformed query string
  • unencoded special characters
  • user environment restrictions

Mailto opens a client; it does not confirm delivery.

Troubleshooting checklist

  1. Confirm link starts with mailto:
  2. Validate recipient format
  3. Validate ? and & placement
  4. URL-encode subject/body text
  5. Test in desktop + mobile browsers
  6. Test with Gmail/Outlook/Apple Mail defaults

For low-risk pages, a manual click test may be enough. For support, billing, sales, or account recovery pages, test the surrounding flow too:

  1. confirm the link opens the expected default client
  2. confirm subject and body values are encoded correctly
  3. confirm mobile and desktop behavior
  4. provide a form or API fallback if the client handoff fails
  5. test any API-backed fallback with inbox assertions and webhooks

Use mailto: for convenience, not as the only path for messages the business must receive.

Security and spam considerations

Publishing plain emails in HTML can increase scraping risk.

Mitigations:

  • use role inboxes (support@, help@) instead of personal addresses
  • rotate exposed addresses used for public pages
  • add form-based fallback for high-value flows

For programmable receive-side workflows, see email API.

When to use mailto vs API sending

Use mailto when:

  • you need very low implementation overhead
  • user can choose/send via local client
  • delivery tracking is not required

Use API/backend sending when:

  • you need reliable transactional delivery
  • attachments/templates are required
  • you need analytics, retries, and auditing

Related implementation guides:

Mailto reliability checklist

Use this checklist to avoid conversion and support drop-offs:

  1. Test mailto flows in an email sandbox across desktop and mobile defaults.
  2. Add form/API fallback paths with email integration testing coverage.
  3. Capture contact-flow events through email webhooks when users choose API-backed forms.
  4. Route follow-up and escalation logic via email automation routing.
  5. Validate end-to-end outcomes with deliverability tests.

This keeps simple mailto UX while protecting critical inbound communication paths.

FAQ

Not consistently. Behavior depends on browser, OS, and configured default client.

Yes. Add both as query parameters and encode values.

What is the correct mailto HTML syntax?

Use an anchor with href="mailto:name@example.com". Add optional parameters after ?, such as subject=..., body=..., cc=..., and bcc=....

Is mailto good for contact forms?

It is acceptable for simple contact flows, but backend forms are more reliable and controllable.

The system default email handler controls which app opens.

Final take

Mailto links are useful for lightweight contact UX, but they are fragile for mission-critical communication.

If email delivery is part of signup, billing, support, or product automation, implement backend/API workflows and test full send-receive behavior.