A href mail to html
You're asking how to convert an HTML link (<a href="...">
) to a mailto link, which allows users to send an email directly from their browser.
Here's the syntax:
<a href="mailto:[email protected]">Send email</a>
In this example, [email protected]
is the email address you want to link to. When a user clicks on the link, their default email client will open with the email address already filled in.
You can also add additional parameters to the mailto
link to specify the subject, body, and other details. Here are some examples:
- To specify the subject:
mailto:[email protected]?subject=Hello
- To specify the body:
mailto:[email protected]?body=Hello+world
- To specify both subject and body:
mailto:[email protected]?subject=Hello&body=Hello+world
Here's an example with all three:
<a href="mailto:[email protected]?subject=Hello&body=Hello+world">Send email</a>
Note that the mailto
protocol is not supported by all email clients, and some may not work as expected. Additionally, some browsers may not allow the user to send an email directly from the browser, instead prompting them to open their email client.