CodesCompiler
🔍
HTMLCSSJavaScriptPythonSQLPHPSEOPostsBooksKids About Contact 🚀 Get Started Free

HTML - Email Links

HTML - Email Links

HTML email links allow users to click on a link and automatically open their default email client with a new message composed to the specified email address.

This is done using the mailto: protocol in the href attribute of an <a> (anchor) tag.

You can also predefine the subject and body of the email using the mailto: protocol. This is done by appending ?subject= and &body= to the email address. Spaces and special characters in the subject and body should be URL-encoded. For example, spaces are encoded as %20 .

Syntax

The following HTML code creates a clickable email link that opens the user’s default email client to send an email to the specified address:

HTML CODE
<a href= "mailto:name@email.com">name@email.com</a>

Following are some examples that illustrate usage of HTML Email link:

The following HTML code illustrates how to create an email link using the href attribute of the <a> tag.

Preview

HTML also allows you to specify a default email subject as well as an email body along with the email address to make it more specific.

Preview

We can also use the cc and bcc parameters to add carbon copy and blind carbon copy recipients, as shown in the below example:

Preview

It is also possible to add multiple recipients to the email link by separating them with commas, as illustrated in the below HTML code.

Preview

Security Concerns

Adding an HTML email link to your webpage is straightforward, but it can expose your email address to spam. Automated programs, known as email harvesters, can scan web pages for email addresses and add them to spam lists. This can result in a significant increase in unwanted emails.