Mailto tag example
The mailto
tag is used to create a hyperlink that, when clicked, opens the user's email client with a pre-filled "To" field and a subject line. Here's an example:
<a href="mailto:[email protected]">Send an email to [email protected]</a>
In this example:
mailto:
is the protocol used to open the email client.[email protected]
is the email address that will be pre-filled in the "To" field.Send an email to [email protected]
is the text that will be displayed as the link text.
You can also add additional parameters to the mailto
tag to pre-fill other fields, such as the subject line and body of the email. Here's an example:
<a href="mailto:[email protected]?subject=Hello&body=This%20is%20a%20test%20email">Send an email to [email protected]</a>
In this example:
subject=Hello
sets the subject line of the email to "Hello".body=This%20is%20a%20test%20email
sets the body of the email to "This is a test email". The%20
is used to encode the spaces in the text.
Note that the mailto
tag is not supported in all browsers, and its functionality may vary depending on the browser and email client being used.