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:
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&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