How to link mail id in html
To link an email address in HTML, you can use the <a>
tag with the href
attribute set to the email address. Here's an example:
<a href="mailto:[email protected]">Contact me</a>
This will create a link that, when clicked, will open the user's default email client with the email address [email protected]
pre-filled in the "To" field.
You can also add additional attributes to the <a>
tag to customize the link. For example:
subject
: sets the subject line of the emailbody
: sets the body of the emailcc
: sets the CC recipientsbcc
: sets the BCC recipients
Here's an example:
<a href="mailto:[email protected]?subject=Hello&body=Hello%20again&[email protected]&[email protected]">Contact me</a>
This will create a link that, when clicked, will open the user's default email client with the email address [email protected]
pre-filled in the "To" field, the subject line set to "Hello", the body set to "Hello again", and the CC and BCC recipients set to [email protected]
and [email protected]
, respectively.
Note that the mailto
protocol is not supported by all email clients, and some clients may not support all of the additional attributes. It's always a good idea to test your links in different email clients to ensure they work as expected.