Create Email Link in HTML



We use HTML <a> tag defines a hyperlink used to link web pages.

The href attribute of the <a> tag, which indicates the link's destination. Which provides us option to specify an email address. To create a link to send mail we use mailto:to specify email address inside href attribute in HTML.

Syntax

Following is the syntax to link a mail address to the web page.

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

Same as the way we link a mobile number. We use mailto instead of tel inside a href attribute.

Example

Following is the example program to link a mail address to the web page.

<!DOCTYPE html> <html> <head><title>None</title></head> <body> <p><a href="mailto:[email protected]">[email protected]</a></p> </body> </html>

When we click on the email address it will navigate us to the default mail app in our system.

Example

Following is another example program to link a mail address to the web page.

<!DOCTYPE html> <html> <head> <title>HTML email link</title> </head> <body> <h2>Contact</h2> <p>For any queries: <a href="mailto:[email protected]">Contact us</a></p> </body> </html>

Example

Following is one more example program to link a mail address to the web page.

<!DOCTYPE html> <html> <body> <h2>Creating a link to send email in HTML</h2> <ol> <li><a href="mailto:[email protected]">Mail 1</a></li> <li><a href="mailto:[email protected]">Mail 2</a></li> <li><a href="mailto:[email protected]">Mail 3</a></li> </ol> </body> </html>
Updated on: 2022-11-18T09:53:52+05:30

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements