HTML Mailto Links

Creating effective and user-friendly communication channels is paramount, HTML mailto links, allows users to initiate emails with a single click.

Usage

HTML mailto links provide a simple way to enable users to send emails by clicking a link on a webpage. The basic structure of a mailto link is as follows:

HTML
<a href="mailto:[email protected]">Send Email</a>

Multiple Recipients

To include multiple recipients, separate their email addresses with commas:

HTML
<a href="mailto:[email protected],[email protected]">Send Email</a>

Adding a subject

You can pre-fill the subject of the email using the subject parameter:

HTML
<a href="mailto:[email protected]?subject=Your%20Subject">Send Email</a>

Adding a body text

Include the body parameter to pre-fill the email body:

HTML
<a href="mailto:[email protected]?body=Hello%20there!">Send Email</a>

You can use spaces in the subject and body, but to be more precise, we recommend you replace spaces with “%20”.

Adding CC and BCC

HTML
<a href="mailto:[email protected][email protected], [email protected], [email protected]&subject=Big%20News">Email Us</a>
HTML
<a href="mailto:[email protected][email protected], [email protected]&subject=Big%20News">Email Us</a>

Combined Parameters

You can combine multiple parameters in a single mailto link:

HTML
<a href="mailto:[email protected]?subject=Your%20Subject&body=Hello%20there!">Send Email</a>

FAQs

Can I include both the subject and body in a mailto link?

Yes, as demonstrated in the examples above, you can combine multiple parameters in a single mailto link to pre-fill the subject, body, and other details.

Is it possible to open the email client without pre-filling any details?

Certainly! You can create a simple mailto link without any parameters:

<a href="mailto:">Send Email</a>

This will open the default email client without pre-filling any information.

References

  1. MDN Web Docs – mailto
  2. W3Schools – HTML mailto Links

Leave a Reply