This is one I don’t use very often so I always forget the syntax. I can remember the basics, adding a mailto: prefix to the link, but beyond that I can never remember the fancier tricks like prefilling in the title, message body and even additional fields like CC.
So first off, here’s an example of a mailto link:
<a href="mailto:firstname.lastname@example.org">E-mail Me!</a>
Output: E-mail Me!
It’s a pretty simple HTML tag, it converts a typical anchor into a link that will automatically launch your default e-mail client and open up a blank e-mail with your address prefilled into the destination field. Now adays you’re likely to see PHP or Ajax forms that you fill out in your browser and it sends the email without ever revealing their address, but in case you bust out some old school HTML here’s some extra parameters you can pass in:
subject = the subject, or title, of your email message body = the default body of the email cc = add an extra address as a carbon copy bcc = add a blind carbon copy address
These are just your typical query string values but your web browser will automatically decipher them and pass them onto your e-mail client. Here’s an example of a mailto link using all of the parameters we’ve learned:
<a href="mailto:email@example.comfirstname.lastname@example.orgemail@example.com&subject=Test Email&body=This is a test email sent from FettesPS.com!">Send Test Email</a>
Output: Send Test Email
The only thing you need to know beyond that is that if you want to send blank lines to the body of the email you will put %0A in place of the carriage return. Have fun!