Html mailto example

The mailto protocol is used to create a link that, when clicked, opens the user's default email client with a pre-filled email message. Here is an example of how to use mailto in HTML:

<a href="mailto:[email protected]">Send an email to [email protected]</a>

In this example, the href attribute is set to mailto:[email protected], which tells the browser to open the user's default email client with the email address [email protected] pre-filled in the "To" field.

You can also add additional parameters to the mailto link to pre-fill other fields in the email message, such as the subject and body. Here is 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, the subject parameter is set to "Hello", and the body parameter is set to "This is a test email". The %20 characters are used to encode the spaces in the subject and body.

Here is a breakdown of the available parameters you can use with mailto:

Here is an example of a mailto link with multiple parameters:

<a href="mailto:[email protected]?subject=Hello&body=This%20is%20a%20test%20email&[email protected]&[email protected]&attach=file.txt">Send an email to [email protected]</a>

In this example, the mailto link pre-fills the "To" field with [email protected], the "Subject" field with "Hello", the "Body" field with "This is a test email", and attaches the file file.txt to the email message. It also sends a copy of the message to [email protected] and a blind copy to [email protected].