Menu

HTML Email Link: mailto with Subject, Body, CC and tel

Make a link that opens a new email with href="mailto:", fill in the subject, body, cc and bcc, encode them correctly, and make click-to-call links with tel: and sms:.

This page includes runnable editors - edit, run, and see output instantly.

Start the link's href with mailto: and the address. Clicking it opens a new message to that address in the reader's mail app.

The preview does not open other apps: clicking one of these links there shows the address it would open. On a real page, the first opens a new email and the second starts a call on a phone.

Use the address itself as the link text. A reader with no mail app set up (common on desktops that use webmail in the browser) can still copy it, and a link that says only "Email us" leaves them stuck.

Subject, body, cc and bcc

A mailto link can fill in more of the message. Add parameters after a ? and join them with &, like a URL query string:

ParameterFills inExample
subjectThe subject line?subject=Order%20question
bodyThe message text&body=Hi%20there
ccCopy recipients&cc=sales@example.com
bccBlind copy recipients&bcc=log@example.com

Several recipients go in the address part, separated by commas: mailto:ana@example.com,bob@example.com.

The values must be URL encoded: a space is %20, a line break is %0D%0A, & is %26 and ? is %3F. The script in this example decodes each link so you can see what the mail app receives:

The subject Order #123 has to be written Order%20%23123: a bare # would end the URL there, and the body would be lost. Do not use + for spaces either. In a mailto link, + is a literal plus sign, and many mail apps show it as one.

Encoding by hand is error prone. encodeURIComponent does it for you. Type in the fields and the link below updates:

encodeURIComponent turns & into %26 and a line break into %0A; the replace makes line breaks the %0D%0A pair that email expects. Leave the address part as typed: @ and , are allowed there without encoding.

tel: makes a click-to-call link. Write the number with the country code and no spaces in the href; the visible text can be formatted however you like.

  • tel:+442079460958 works from any country. A local number like tel:02079460958 only works for callers inside that country.
  • Hyphens are allowed as separators (tel:+1-555-123-4567); spaces are not part of the format, so leave them out of the href.
  • sms: opens the messaging app. Adding a message with ?body= works in many apps, but support differs, so do not rely on it.
  • On desktop, tel: opens a calling app if one is installed (such as FaceTime or a softphone), and does nothing otherwise.

Safari on iPhone turns phone numbers in plain text into links by itself. If that breaks something like an order number, turn it off with <meta name="format-detection" content="telephone=no">.

Spam and email addresses

An address in a mailto link is readable by any bot that downloads the page. Tricks like writing hello [at] example [dot] com or assembling the address with JavaScript stop some simple scrapers, but they also make the link harder to use. A contact form, covered in HTML forms, keeps the address out of the page entirely. For most sites, a good spam filter on the inbox is the simpler answer.

Avoid <form action="mailto:...">. It depends on the reader's mail app, sends the fields URL encoded and hard to read, and gives you no confirmation that anything was sent.

Common mistakes

  • Forgetting mailto:. href="hello@example.com" is a relative link to a page named after the address.
  • Unencoded spaces or # in the subject or body. Encode values with %20, %23, or encodeURIComponent.
  • Using + for spaces. It shows up as a plus sign.
  • A second ? instead of &. Only the first parameter follows ?; the rest are joined with &.
  • "Email us" as the only text, which leaves webmail users nothing to copy.
  • Local phone numbers in tel:. Include the country code.

Frequently Asked Questions

How do I create an email link in HTML?

Use a link whose href starts with mailto: followed by the address: <a href="mailto:hello@example.com">hello@example.com</a>. Clicking it opens a new message in the reader's default mail app.

How do I add a subject to a mailto link?

Add it as a query parameter after ?: mailto:hello@example.com?subject=Order%20question. Encode spaces as %20, and join more parameters with &, for example ?subject=Hi&body=Hello.

How do I send a mailto link to multiple recipients?

Separate the addresses with commas: mailto:ana@example.com,bob@example.com. Use cc= and bcc= parameters for copies: mailto:ana@example.com?cc=bob@example.com&bcc=cy@example.com.

How do I make a phone number clickable in HTML?

Use a tel: link with the number in international format: <a href="tel:+15551234567">+1 555 123 4567</a>. On phones it starts a call; on desktop it opens whatever calling app is installed, if any.

Why does my mailto link do nothing?

The link only hands the address to the default mail app. If the reader has none set up, which is common on desktops that use webmail, nothing useful happens. Show the address as the link text so it can be copied.

Coddy programming languages illustration

Learn to code with Coddy

GET STARTED