How do you create an email link?
Use "mailto" to create a link that attempts to open a user's email client and set the "to" address.
A email link is written using the
<a> just like a regular link. Just set the
href attribute to "mailto:" followed by the user's email address. For example:
<a href="mailto:firstname.lastname@example.org">Email Link Text Here</a>
Some things you will want to consider:
- Email links only work if the user has an email client set up. As such, you should consider setting the text of the link to the email address itself so that users who don't have their email clients set up can find the email address.
- Email addresses in mailto links are easily discoverable by bots, so don't be surprised if your spam level increases after you use your email address in a mailto link.
- You can set a default subject a default subject and body using the
bodyparameters, like this:
<a href="mailto:email@example.com?subject=Revolutionary War&body=Nice job with that!">firstname.lastname@example.org</a>