Skip to content

How to Create Mailto HTML Links | Simple Example code

  • by

The mailto HTML Linke is redirecting to an email address instead of a web page URL. On click, the Mailto link, the default email client on the user’s computer opens and suggests sending a message to the email address mentioned in the Mailto link.

Syntax

You need to use the HTML <a> tag with its href attribute, and insert a “mailto:” parameter after it:-

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

Example of Mailto Links in HTML

Let’s see how to create an email link in HTML (complete code):-

<!DOCTYPE html>
<html>
  <body>
    
      <p>Written by: W3docs Team</p>
      <p>Contact US:
        <a href="mailto:[email protected]?subject=Mail from our Website&body=Dear EyeHunts Team">Send Email</a>
  </body>
</html>

Output:

Create Mailto HTML Links

mailto html body

To add a body text, use the “body” parameter with other parameters:

<a href="mailto:[email protected]?subject=Mail from our Website&amp;body=Some body text here">Send Email</a>

mailto html with subject

For subject field, add the “subject” parameter to the href attribute:

<a href="mailto:[email protected]?subject=Mail from our Website">Send Email</a>

Do comment if you have questions and suggestions on this topic.

Note: The All HTML Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version

Leave a Reply

Discover more from Tutorial

Subscribe now to keep reading and get access to the full archive.

Continue reading