How to Create a Mailto Link in HTML

How to Create a Mailto Link in HTML

A mailto link turns a plain email address on your website into a clickable link that opens the visitor's email app with everything ready to go.

Read more

Instead of asking people to copy your address, you let them click once and start writing.

Read more

Creating a mailto link in HTML is simple, and you can even pre-fill the subject and message.

Read more

This guide explains the syntax, how to add a subject and body, and the small details that make a mailto link work reliably.

Read more

What Is a Mailto Link?

Read more

A mailto link is a standard web link that uses the mailto: scheme instead of http.

Read more

When someone clicks it, their device opens its default email program with a new message addressed to you.

Read more

It is the normal way to add a contact email to a web page, a footer, or an email signature.

Read more

Because it relies on the visitor's own email app, a mailto link works everywhere without any server-side code. It is pure HTML.

Read more

The Basic Mailto Link Syntax

Read more

At its simplest, a mailto link looks just like a normal link, but the href starts with mailto: followed by the address:

Read more

The link text is whatever you want people to see, such as "Email us" or the address itself. The href value is mailto: plus the email address.

Read more

So a basic mailto link points its href to mailto:hello@example.com, and the clickable text can read "Email us." That is all you need for a working email link.

Read more

Adding a Subject and Message

Read more

The real power of a mailto link is pre-filling the email. You can add a subject line and a message body so the visitor's email opens partly written.

Read more

This is done by adding parameters after the address, starting with a question mark.

Read more

Subject is added with ?subject= followed by your text. Body is added with &body= followed by your message.

Read more

The one rule to remember is that spaces and special characters must be encoded. A space becomes %20 and a line break becomes %0A.

Read more

If you do not encode them, some email apps will cut off the subject or body. This is exactly the kind of fiddly detail that is easy to get wrong by hand.

Read more

Adding CC, BCC, and Multiple Recipients

Read more

You can also pre-fill carbon copy and blind carbon copy recipients:

Read more

CC uses &cc= followed by the address. BCC uses &bcc= followed by the address. Multiple recipients are separated by commas in any of the fields.

Read more

So a single link can address your support inbox, copy a manager, and add a subject line, all before the visitor types a word.

Read more

The Easy Way: Use a Generator

Read more

Did you like this story?

Please share by clicking this button!

Visit our site and see all other available articles!

Fix Up Easy

Continue reading

What Is Lorem Ipsum and Why Designers Use It