Mailto link code html
To create a mailto link in HTML, you can use the following code:
<a href="mailto:[email protected]">Send an email to [email protected]</a>
Replace [email protected]
with the actual email address you want to link to.
You can also add additional parameters to the mailto link to specify the subject, body, and other details. For example:
<a href="mailto:[email protected]?subject=Hello%20from%20HTML&body=This%20is%20a%20test%20email">Send an email to [email protected]</a>
This will open the email client with the subject "Hello from HTML" and the body "This is a test email".
Here's a breakdown of the parameters you can use:
subject
: sets the subject of the emailbody
: sets the body of the emailcc
: sets the CC recipientsbcc
: sets the BCC recipientsto
: sets the TO recipient (default is the email address specified in the href attribute)
Note that the parameters should be URL-encoded using the %
symbol, as shown in the example above.
You can also use the mailto
attribute on an a
element to specify the email address and other details:
<a mailto="[email protected]" subject="Hello from HTML" body="This is a test email">Send an email to [email protected]</a>
This is equivalent to the previous example, but uses the mailto
attribute instead of the href
attribute.