Written by: Geoffrey Callaghan
A Complete Guide To HTML Mailto Attribute
A Complete Guide To HTML Mailto Attribute
The mailto
attribute in HTML is used to create hyperlinks that open the user’s default email client with a new email message. When a user clicks on a mailto
link, it launches their email application and populates the To, CC, BCC, Subject, and Body fields of the new email. Here’s a comprehensive guide to using the mailto
attribute:
<a href="mailto:recipient@example.com">Send Email</a>
mailto
URL:Recipient (To):
to
parameter to specify the email address of the recipient.<a href="mailto:recipient@example.com">Send Email</a>
Subject:
subject
parameter to set the email subject.<a href="mailto:recipient@example.com?subject=Subject%20Text">Send Email</a>
CC (Carbon Copy):
cc
parameter to specify email addresses for carbon copy recipients.<a href="mailto:recipient@example.com?cc=cc1@example.com,cc2@example.com">Send Email</a>
BCC (Blind Carbon Copy):
bcc
parameter to specify email addresses for blind carbon copy recipients.<a href="mailto:recipient@example.com?bcc=bcc1@example.com,bcc2@example.com">Send Email</a>
Body (Message):
body
parameter to pre-fill the email body.<a href="mailto:recipient@example.com?subject=Subject%20Text&body=Message%20Text">Send Email</a>
Multiple Parameters:
&
).<a href="mailto:recipient@example.com?subject=Subject%20Text&cc=cc1@example.com&body=Message%20Text">Send Email</a>
%20
.<a href="mailto:recipient@example.com?subject=Subject%20Text&cc=cc1@example.com&bcc=bcc1@example.com&body=Message%20Text">Send Email</a>
to
parameter.In summary, the mailto
attribute is a useful tool for creating email links in HTML, allowing you to pre-define various parameters to streamline the email creation process for users.
mailto attributes in HTML are vulnerable to scraping due to plain text exposure in the HTML source.
You can use VeilMail.io to hide email address from spammers. VeilMail makes sure it’s a human reading your email address and not a bot or a email scraper.