ShortIQ

ShortIQ

Marketing

How to Create a Mailto Link: HTML, Subject Lines, and Mailto Generator

Everything you need to know about mailto links: the HTML syntax, how to add subject, body, CC, and BCC, when to use them vs contact forms, how to track clicks, and how a mailto generator builds them instantly.

July 17, 2026Updated October 24, 2026•ShortIQ Editorial TeamEditorial approach and corrections

Worked example: Create an email enquiry with a literal ampersand

Example inputs

To: support@example.com
Subject: Pricing & setup
Body: Hello,
Please share your plans.

Expected output

mailto:support@example.com?subject=Pricing%20%26%20setup&body=Hello%2C%0D%0APlease%20share%20your%20plans.

The subject must retain its ampersand, and the message must have two lines. The URI encodes spaces as %20, the ampersand as %26, and the message line break as %0D%0A. When adding the URI to an HTML attribute, escape parameter separators as &.

What this does not verify

This creates a draft; it does not send an email or confirm delivery. Opening the draft depends on a configured mail handler. BCC addresses embedded in a public link are visible in its source. Provide a visible contact address as a fallback.

Try these inputs in the tool

The Basic Mailto HTML Syntax

The simplest mailto link uses just the recipient address: use an anchor tag with href set to mailto:recipient@example.com. The link text can be anything you want it to say: Email us, Contact support, or the email address itself.

To add a subject line, append a question mark after the address and add the subject parameter: mailto:recipient@example.com?subject=My%20Subject%20Line. Encode spaces as %20. A plus sign is a literal plus in a mailto URI, not a reliable replacement for a space. The subject appears in the draft when a compatible mail handler opens it.

To add multiple parameters (subject and body, or subject and CC), separate each one with an ampersand: mailto:recipient@example.com?subject=Hello&body=I+would+like+to+inquire+about+your+services. All values in the query string must be URL-encoded to handle spaces, line breaks, and special characters correctly.

Adding Subject, Body, CC, and BCC

The mailto protocol supports four parameters: to (the recipient, which can be specified in the link address itself), subject (the email subject line), body (the pre-filled email body), and cc and bcc (carbon copy and blind carbon copy recipients). All are appended to the link address as URL query parameters.

A complete example is mailto:support@example.com?cc=manager@example.com&subject=Support%20Request&body=Hello%2C%0D%0APlease%20describe%20your%20issue. Use %0D%0A for a CRLF line break in the message body. BCC is also supported by compatible clients, but an address embedded in a public link is visible in the page source and should not be treated as confidential.

Keep pre-filled body text short and general. Long pre-filled messages feel prescriptive and many visitors will clear them before typing their actual message. A useful body might just be Hi, I have a question about or I am interested in learning more. Leave the specifics for the visitor to fill in.

  • to: the recipient email address (set in the mailto: address itself)
  • subject: pre-fills the subject line (?subject=Your+Subject)
  • body: pre-fills the email body (&body=Your+message)
  • cc: adds a carbon copy recipient (&cc=other@example.com)
  • bcc: adds a blind carbon copy (&bcc=hidden@example.com)

FAQ

What is a mailto link?

A mailto link is an HTML hyperlink using the mailto: protocol. When clicked, it opens the visitor default email client with a new compose window addressed to the email address specified in the link. You can also pre-fill the subject line, body, CC, and BCC using URL query parameters.

How do I create a mailto link in HTML?

Use an anchor tag with the href attribute set to mailto: followed by the recipient email address. For example: the anchor tag with href=mailto:you@example.com and link text of Email us. To add a subject, append ?subject=Your+Subject after the email address. Use a mailto link generator to build the full link with all parameters without manual encoding.

Can I add a subject line to a mailto link?

Yes. Use mailto:you@example.com?subject=Your%20Subject%20Here. Encode spaces as %20 and literal ampersands in the subject as %26. A compatible mail client can then populate the draft subject.

Do mailto links work on mobile?

Yes. On iOS and Android, clicking a mailto link opens the default mail app on the device with the compose window pre-filled. If the user has multiple email apps installed, the phone may ask which one to open. The subject and body parameters are respected by all major mobile email apps.

Can I use a mailto link in an email?

Technically yes, but it rarely works as intended. When a mailto link is clicked inside an email client, the behavior depends on the client: some open a new compose window, some do nothing, and some produce an error. If you want a reply button in an email, use a standard Reply-To header rather than a mailto link in the email body.

How do I add a body message to a mailto link?

Add a body parameter, for example mailto:you@example.com?subject=Hello&body=I%20would%20like%20to%20inquire. Encode spaces as %20 and line breaks as %0D%0A. When placing the URI inside an HTML attribute, escape parameter separators as &.

How do I track who clicks a mailto link?

Add a JavaScript click event listener to the mailto link that fires a Google Analytics event before the browser follows the link. In GA4, log an event with the category of contact and action of email_click. You can also use Google Tag Manager to set this up without touching your site code. The GA4 event is recorded even though the browser opens an external email app.

Why does my mailto link open the wrong email app?

The browser opens the operating system default email client, not necessarily the app the visitor uses most. On a desktop browser, if the user uses Gmail in the browser rather than an installed app, the mailto link may open a native mail app they do not use. To help webmail users, display the email address as visible text alongside the link so they can copy and paste it into their webmail compose window.

Related free tools

If you want to turn this topic into action, use one of ShortIQ's free tools for campaign planning, UTM structure, or QR distribution.

Continue Reading

Explore related guides, examples, and practical workflows.

Free newsletter

Get new guides in your inbox

We publish practical guides on dev tooling, prompt engineering, marketing workflows, and deployment. No fluff — straight to the point.

No spam. Unsubscribe any time.

Was this article helpful?

Tell us if this guide solved the problem or what was still missing. We use this to improve the blog and only follow up if you explicitly allow it.

We use this to improve tutorials, examples, and technical depth.