Skip to main content

Email Links

HTML links are not just limited to navigating between web pages, we can also use them to send emails. In this tutorial, we shall learn how to create an email link using HTML.

An email link is a type of HTML link that activates the default mail client on the computer for sending an email. The basic syntax to create an email link is as follows:

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

In the above code, replace [email protected] with the email address you want to link to. The text between <a> and </a> is the part that will be visible to the user, which they can click to send an email.

Adding Subject Line to the Email

HTML allows us to add a subject line to the email by modifying the mailto: link. We can include the subject field using ?subject= tag. Here's an example:

<a href="mailto:[email protected]?subject=Hello">Send Email</a>

In the above example, when the user clicks the link, the email client will open with the "To" field already filled with [email protected] and the "Subject" line filled with "Hello".

Adding Body Text to the Email

We can further customize the email by adding body text using &body= tag. Here's how we can do that:

<a href="mailto:[email protected]?subject=Hello&body=How are you?">Send Email</a>

In this example, when the user clicks the link, the email client will open with the "To" field filled with [email protected], the "Subject" line filled with "Hello", and the "Body" filled with "How are you?".

Adding CC and BCC to the Email

HTML also allows us to add Carbon Copy (CC) and Blind Carbon Copy (BCC) to the email by modifying the mailto: link. Here's how to include CC and BCC:

In this example, when the user clicks the link, the email client will open with the "To" field filled with [email protected], and the "CC" and "BCC" fields filled with [email protected] and [email protected] respectively.

Remember, when using multiple parameters like subject, body, cc, or bcc, they must be combined using the & symbol.

And that's it! Now you know how to create an email link in HTML. Practice creating different types of email links with varying parameters to get a good grasp of this concept. Happy learning!