File Under: HTML

Make a Mailto Link

To create a link that sends an e-mail to somebody, use the HTML mailto: tag.

Your code will look like this:

<a href="mailto:webmonkey@wired.com>Send an e-mail to Webmonkey</a>

and tell us how much you love cats.

When the reader clicks on that link, their default e-mail application will launch and a blank e-mail addressed to webmonkey@wired.com (or whatever address you put in the link) will open up.

You can fill out a subject for them, too. Just throw a ?subject= into your code. Your markup will end up looking something like this:

<a href="mailto:webmonkey@wired.com?subject=I-love-cats-too!">Jon</a>,

a Webmonkey writer, adores cats.



Share your cat stories with him and you'll make his day!

He especially loves cat images -- so feel free to mail

him attachments.

This is what the code will look like on your Web page:

Jon, a Webmonkey writer, adores cats. Share your cat stories with him and you’ll make his day! He especially loves cat images – so feel free to mail him attachments.

When he gets your feline-friendly mail, the subject: line in all the mail will read, “I love cats too!”

Tip: This hack works for the cc: and bcc: fields as well, so you can address e-mails to multiple recipients all in one link.

You can also write &body= text as well.

When using these multiple field tricks in your mailto links, be sure to escape the ampersands with ‘&amp;’. Doing that will allow your code to render properly inside rich e-mail clients.


<a href="mailto:webmonkey@wired.com&amp;cc=foo@wired.com&amp;bbc=bar@wired.com&amp;body=Boy, I sure love cats>Send an e-mail to Webmonkey</a> and tell us how much you love cats.