Mail html tag
The <mail>
tag is not a standard HTML tag. However, there are a few ways to create a mailto link in HTML:
-
Using the
<a>
tag with thehref
attribute:<a href="mailto:[email protected]">Send an email</a>
This will create a link that, when clicked, will open the user's default email client with the address
[email protected]
pre-filled. -
Using the
mailto
protocol:<a href="mailto:[email protected]?subject=Hello&body=This%20is%20a%20test">Send an email</a>
This will create a link that, when clicked, will open the user's default email client with the address
[email protected]
, subjectHello
, and bodyThis is a test
. The%20
is used to encode the space character.
Note that the mailto
protocol is not a standard protocol and may not work on all devices or browsers.
- Using a JavaScript function:
<a onclick="window.location.href='mailto:[email protected]';">Send an email</a>
This will create a link that, when clicked, will execute a JavaScript function that sets the
window.location.href
property tomailto:[email protected]
, which will open the user's default email client.
It's worth noting that the <mail>
tag is not a valid HTML tag and should not be used. Instead, use one of the above methods to create a mailto link.