Html link mail
You're looking to create an HTML link that opens a mail client with a pre-filled email address and subject!
Here's the syntax:
<a href="mailto:[email protected]?subject=Your%20Subject%20Here">Send Email</a>
Let's break it down:
mailto:
is the protocol used to open a mail client.[email protected]
is the email address of the recipient.?subject=Your%20Subject%20Here
is the query string that sets the subject of the email. The%20
is an encoded space character, as spaces are not allowed in URLs.
You can add more query string parameters to customize the email:
[email protected]
to add a carbon copy recipient.[email protected]
to add a blind carbon copy recipient.?body=This%20is%20the%20email%20body
to set the email body.
Here's an example with multiple query string parameters:
<a href="mailto:[email protected]?subject=Your%20Subject%20Here&[email protected]&body=This%20is%20the%20email%20body">Send Email</a>
When a user clicks on this link, their default mail client should open with the pre-filled email address, subject, and body.