Time for a little HTML magic.
You all probably know how to add an email link to a webpage. You use the <a href=""> tag just as you would to link to a webpage. Instead of placing the URL within the quotes of the tag, you type "mailto:email address here" (without the quotes).
Thanks to that extra code, once the user clicks the email link, the user's email client will launch and put the address in automatically.
Filling in the address is nice, but what about the rest of the headers?
Turns out there's a syntax for every one of those, too. You can automatically fill in the CC field, BCC field, and Subject field. You can even add a bit of text to the email body.
Here's how you do it. We'll use thescreensavers@techtv.com as our example email address.
- Subject field: To automatically fill in the subject field, add the code in red to the end of your email address in the mailto link.
<a href="mailto:thescreensavers@techtv.com?subject=Your subject here"> - Adding CC recipients: To automatically copy the message to a friend in the CC field, use the following code in red.
<a href="mailto:thescreensavers@techtv.com?subject=Your subject here&cc=Your friend's address"> - Adding BCC recipients: To automatically copy the message to a friend in the blind CC field, use the following code in red.
<a href="mailto:thescreensavers@techtv.com?subject=Your subject here&bcc=Your friend's address"> - Adding text to the message body: You can even add a bit of your own text to the top of the reply message. To do it, add the code in red to your mailto link.
<a href="mailto:thescreensavers@techtv.com?subject=Your subject here&body=Whatever you want the body to say goes here">
These additional attributes are great. They make it easier for your users to fill in forms on the webpage. And filling in the subject line makes it easier for you to sort your emails.
Comments
Add a Comment