How to Format a ‘mailto:’ URL in a Link With Tool

Online Mailto Link Generator

Try our free online HTML link Generator.











How it Works / How to Manually Create One

A mailto: URL can be used within a hyperlink to provide a convenient way for users to send an email. Clicking the hyperlink will open the default email client on the user’s computer, with certain fields pre-populated as specified in the URL. This guide will explain how to format a mailto: URL, and how to include or exclude various options.

Basic mailto: Format

The basic mailto: link format is straightforward. You simply start with mailto: and then provide the recipient’s email address:

htmlCopy code<a href="mailto:[email protected]">Send me an email!</a>

In this example, clicking “Send me an Email!” would open the user’s email client with a new email pre-addressed to “[email protected]“.

Adding Subject and Body

You can add a subject line to the email by including ?subject= followed by your desired subject text:

htmlCopy code<a href="mailto:[email protected]?subject=Hello%20World">Email with subject</a>

Note the use of %20 to encode a space. In URLs, spaces and certain other characters must be percent-encoded.

You can also pre-populate the body of the email using &body=:

htmlCopy code<a href="mailto:[email protected]?subject=Hello%20World&body=Nice%20to%20meet%20you.">Email with subject and body</a>

Adding CC and BCC

You can add CC (carbon copy) and BCC (blind carbon copy) addresses to your mailto: link using &cc= and &bcc=:

htmlCopy code<a href="mailto:[email protected][email protected]&[email protected]">Email with CC and BCC</a>

Multiple CC or BCC recipients can be included by separating the email addresses with commas:

htmlCopy code<a href="mailto:[email protected][email protected],[email protected]&[email protected]">Email with multiple CC and BCC</a>

Leaving Out Options

To create a mailto: link that only opens the email client without pre-populating any fields, simply use mailto: without following it with an email address:

htmlCopy code<a href="mailto:">Open your email client</a>

This will open the user’s email client with a new, blank email.

Similarly, you can create a mailto: link that only includes a subject, body, CC, or BCC, by excluding the email address and starting with mailto:?:

htmlCopy code<a href="mailto:?subject=Just%20a%20subject">Email with only a subject</a>

In this case, the email client would open a new email with the specified subject, but the “To” field would be left blank for the user to fill in.

Conclusion

Using mailto: URLs in hyperlinks provides a handy way to facilitate email communication with your users. Remember to percent-encode any spaces or special characters in the URL to ensure it works properly. Whether you include an email address, subject, body, CC, BCC, or any combination of these, is up to you and should be based on what best serves the needs of your users.

Leave a Reply