J. Cornelius

Super Ninja Mailtos

November 18, 2003

Mailtos are a convenient way to let your audience offer feedback on your Web site or to arrange other contact information. But you can do a lot more with a mailto than just automatically generate an e-mail message. Super ninja mailtos can automatically CC and BCC people, or even fill in the subject line. You could go read the RFC to learn how, or you could just keep reading for the quick and dirty on how to customize your mailto functions.

Your basic mailto looks like this:

>a href="mailto:person@site.com"< Click here to send a boring old mailto message</a>

When users click the link, it brings up their e-mail client with the recipient's e-mail address prepopulated in the To field. Snore. To spice it up, follow these steps.

The Ninja CC

To copy (CC) someone on the e-mail, follow the To recipient's e-mail address with ?cc=. The example below shows how the code should look:

<a xhref="mailto:person@site.com?cc=second_person@site.com"> Click here to send an e-mail message to multiple recipients</a>

The Secret Ninja BCC

To blind copy (BCC) someone on the e-mail, follow the CC recipient's address with &bcc= (as you add these features, the first one begins with a ? and subsequent ones begin with a &). It should look something like this:

<a xhref="mailto:person@site.com?cc=second_person@site.com&bcc=third_person@site.com"> Click here to send an e-mail message to multiple recipients (only some of which you know about)</a>

You can also separate numerous To, CC, and BCC recipients by commas:

<a xhref="mailto:person@site.com, second_person@site.com"> Click here to send an e-mail message to multiple comma-delimited recipients.</a>

The Ninja Subject Line

To prepopulate the Subject field, follow steps one and two with &subject=. For spaces, use the escaped version, %20. The whole string (with To, CC, BCC, and Subject) should look like this:

<a xhref="mailto:person@site.com?cc=second_person@site.com&bcc=third_person@site.com&subject= This%20is%20only%20a%20test">Click here to send us super ninja e-mail</a>

Ahh.... Very good Grasshopper

So now that you know how to do Super Ninja Mailtos, you can impress your friends and co-workers. Good for you.

Was it good for you?

Post to Digg Post to del.icio.us Post to ma.gnolia Post to Furl Post to Mixx

Tags

development, howtos, html

About

J Cornelius is a software developer, Web developer, and Formula 1 fan in Atlanta GA. He has a strange affinity for odd numbers, european sports cars, thoughtful analogies, and is hopelessly addicted to chips & salsa. Read more

Recent Articles