# HTML mailto link syntax, parameters, subject, body, CC, and BCC

Build reliable HTML mailto links with subject, body, CC, BCC, multiple recipients, URL encoding, JavaScript generation, and fallback testing guidance.

An HTML mailto link lets someone open an email draft directly from your page. You can prefill the recipient, subject and a short message, then let them review and send it in their email app.

The basic link takes one line. Most bugs appear when a subject contains an ampersand, a body needs line breaks, or HTML escaping gets confused with URL encoding. Here are the working patterns and the checks that keep those details intact.

## Quick answer: what is an HTML mailto link?

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.

```html
<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.

If the message is important to sales, support, billing, signup, or account recovery, pair the mailto link with a form or API fallback that MailSlurp can test end to end.

## 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&amp;body=Steps%3A%0D%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>`                   |

URL-encode parameter values, then HTML-escape the completed URL when writing it inside an HTML attribute. The recipient is optional: `mailto:?subject=Hello` opens a draft in which the user chooses the recipient.

## Mailto HTML code pattern

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

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

Use this pattern when you need a subject and body:

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

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

## Mailto syntax basics

General pattern:

```text
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:

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

## Mailto parameters reference

Use this reference when building or debugging a `mailto:` URL.

| Field     | Required? | Placement       | Notes                                                          |
| --------- | --------- | --------------- | -------------------------------------------------------------- |
| Recipient | No        | after `mailto:` | Use one address for the most predictable behavior              |
| `subject` | No        | query parameter | Encode spaces, punctuation, and dynamic values                 |
| `body`    | No        | query parameter | Keep it short and encode line breaks                           |
| `cc`      | No        | query parameter | Test client support before relying on it                       |
| `bcc`     | No        | query parameter | Do not treat client-side BCC as an audit or compliance control |

The first parameter starts with `?`. Every parameter after that starts with `&`.

```text
mailto:support@example.com?subject=Support%20request&body=Account%20ID%3A%20
```

## Mailto subject and body examples

### Support request

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

### Sales inquiry

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

### Bug report

```html
<a
  href="mailto:bugs@example.com?subject=Bug%20report&amp;body=Expected%3A%0D%0AActual%3A%0D%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
- `%0D%0A` for new lines
- `%26` for literal `&`
- `%3F` for literal `?`

Example with line breaks:

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

### URL encoding and HTML escaping are different

In a URL, `&` separates parameters. In HTML source, write that separator as `&amp;`. A literal ampersand inside the subject becomes `%26` instead. For example, this HTML opens a draft with the subject "Sales & support":

```html
<a href="mailto:support@example.com?subject=Sales%20%26%20support&amp;body=Hello%0D%0A">Email support</a>
```

[RFC 6068](https://www.rfc-editor.org/rfc/rfc6068.html) specifies `%0D%0A` for body line breaks. The body is plain text; putting HTML tags in it does not create an HTML email. Encode each value once to avoid turning `%20` into the literal text `%2520`.

## Generate mailto links in JavaScript

Use JavaScript when the subject or body depends on page state, account IDs, locale, or workflow context.

For a static link, use the [free mailto link generator](/tools/mailto-link-generator/) to create the encoded URL and ready-to-use HTML without assembling the query string by hand.

```js
const recipient = "support@example.com";
const subject = encodeURIComponent("Support request");
const body = encodeURIComponent("Account ID:\r\n\r\nWhat happened?");
const href = `mailto:${recipient}?subject=${subject}&body=${body}`;
```

Assign the resulting `href` to a link's DOM property as a URL; do not insert `&amp;` into that JavaScript string. HTML entity escaping belongs in HTML source.

Avoid building dynamic `mailto:` URLs by concatenating raw strings. A single unencoded `&`, `?`, or line break can change the parameter structure.

## Multiple recipients with mailto

You can add multiple recipients separated by commas:

```html
<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](/guides/email-attachments-api/) and [attachments guide](/guides/attachments/).

## Why mailto links fail in production

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

## Testing HTML mailto links before release

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.



### Don't leave a customer's request hanging

Use a MailSlurp inbox to receive messages from your fallback contact form. Check the recipient, reply address and body before a customer's request depends on them.

[Test your contact emails](https://app.mailslurp.com/sign-up/?onboardingRequest=testing)



## MailSlurp fallback workflow for critical contact paths

When someone's mail app won't open, a contact form gives them another way to reach you. Test that form with a MailSlurp inbox so you can see what your support team would receive.

Use this pattern for support, sales, billing, or onboarding forms:

1. keep the visible mailto link for users who prefer their email client
2. add a form or API-backed fallback for reliable capture
3. send fallback submissions to a MailSlurp inbox or route
4. assert the received subject, body, attachments, and sender details
5. trigger webhooks or automation for ticketing, CRM, or follow-up flows

Related guides and tools:

- [Send HTML form submissions to email](/guides/send-form-to-email/)
- [Email integration testing](/product/email-integration-testing/)
- [Email Sandbox](/product/email-sandbox/)
- [Email webhooks](/guides/email-webhooks/)
- [Email automation routing](/product/email-automation-routing/)

## 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](/product/email-address-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:

- [Send email with JavaScript](/blog/javascript-send-email/)
- [SMTP relay guide](/guides/smtp-relay/)
- [Mailto link use in HTML](/guides/mailto-link-use-in-html/)

## Mailto reliability checklist

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

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

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

## FAQ

### Do mailto links work on all devices?

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

### Can I add both CC and BCC in a mailto link?

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.

### Why does my mailto link open the wrong app?

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.
