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, 2026ShortIQ Editorial Team

What Is a Mailto Link and How Does It Work

A mailto link is an HTML hyperlink that opens the visitor email client with a new compose window when clicked. Instead of the usual http:// or https://, the link uses the mailto: protocol, followed by the recipient email address. The browser recognizes this protocol and hands it off to the default email client on the device, whether that is Gmail, Outlook, Apple Mail, or another app.

The mailto link is the simplest way to add a contact email to a website. It requires no backend, no form processing, no spam filtering, and no server-side code. A visitor clicks the link, their email client opens with the to address pre-filled, and they compose and send their message directly from their own inbox.

The limitation is that mailto links depend on the visitor having a configured email client. On most phones and work computers this is true, but on shared or kiosk computers it may not be. For maximum compatibility, display the email address as visible text alongside the mailto link so visitors can also copy and paste it manually.

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+Subject+Line. Spaces in the subject are encoded as plus signs (+) or %20. The subject will appear pre-filled in the compose window when the visitor clicks the link.

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 mailto link with all four components looks like this: mailto:support@example.com?cc=manager@example.com&bcc=audit@example.com&subject=Support+Request&body=Hello%2C%0A%0APlease+describe+your+issue. The %0A characters are URL-encoded newlines, which produce line breaks in the email body. A mailto link generator handles this encoding automatically.

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)

When to Use Mailto Links vs Contact Forms

Mailto links are best for simple, low-volume contact situations: a personal website, a freelancer portfolio, a small business contact page, or a support email on a tool or SaaS landing page. They are easy to implement, have no moving parts, and keep the email thread in the visitor email client rather than a third-party inbox.

Contact forms are better when you need to collect structured information (name, company, project type, budget), integrate with a CRM or helpdesk, route inquiries to different teams based on topic, or prevent spam without exposing your email address publicly (spam bots harvest email addresses from mailto links).

A common middle ground is a contact form for the main contact page and mailto links in the header, footer, and email signatures for visitors who prefer email. This gives you the spam protection and data collection of a form for inbound leads while still offering direct email access for visitors who want it.

Mailto Links in Different Email Clients

Most desktop and mobile email clients handle mailto links correctly: Apple Mail, Microsoft Outlook, Mozilla Thunderbird, and the Gmail and Outlook apps on iOS and Android all open a compose window when a mailto link is clicked. The subject and body parameters are respected by all major clients.

The exception is Gmail and Outlook when accessed through a web browser rather than an app. On Chrome, Firefox, and Edge, you can set Gmail or Outlook as the default handler for mailto links in the browser settings. If this handler is not set, clicking a mailto link on a desktop web browser may open the operating system default email app instead, which may not be what the visitor uses.

This is why displaying the email address as visible text alongside the mailto link is good practice. A visitor who uses webmail in the browser can copy the address from the page text and paste it into their webmail compose window directly, rather than clicking a link that opens an email app they might not use.

How to Track Mailto Link Clicks

Mailto clicks are not tracked by default in Google Analytics or most web analytics tools. The browser hands off to the email client without sending a pageview or event to your analytics. To track clicks, you need to intercept the click event in JavaScript and fire an analytics event before the browser follows the mailto link.

In Google Analytics 4, add a click event listener to all mailto links on the page that fires an event with event_name: contact_click and event_category: email. This records every click in your GA4 reports even though the link opens an external app. You can also use Google Tag Manager to set this up without modifying your site code directly.

For link-level analytics without JavaScript tracking, route the mailto link through a redirect URL and track clicks on the redirect. This is less common for mailto links than for standard HTTP links but is technically possible with a server-side redirect that logs the click before opening the mailto URL.

Using a Mailto Link Generator

A mailto link generator builds the correctly URL-encoded link from plain text inputs. You fill in the recipient, subject, body, CC, and BCC fields in plain text, and the generator produces the mailto link with all special characters properly encoded. This is much faster than manually encoding spaces as %20 and newlines as %0A.

The ShortIQ mailto link generator lets you fill in all five parameters, preview the resulting link, and copy the HTML anchor tag or the raw mailto URL. Use it for any email link on your website, in your email signature HTML, or in a digital business card.

If you want to test the link before adding it to your site, paste the generated mailto URL directly into a browser address bar and press Enter. Your default email client should open with the compose window pre-filled. Check that the subject and body appear correctly and that any special characters (commas, apostrophes, line breaks) are handled as expected.

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. Append a question mark after the email address and add the subject parameter: mailto:you@example.com?subject=Your+Subject+Here. Spaces must be URL-encoded as plus signs (+) or %20. The subject will appear pre-filled in the compose window when the visitor clicks the link.

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 the body parameter after the subject (if present) using an ampersand: mailto:you@example.com?subject=Hello&body=I+would+like+to+inquire. Spaces are encoded as + or %20 and newlines as %0A. Use a mailto link generator to handle this encoding automatically rather than encoding it by hand.

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 more guides on link shortener SaaS strategy, Bitly alternatives, and white label link management.

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.