<<Back to Article

Make a Mailto Link

/skill level/
/viewed/
0 Times

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.


  • This page was last modified 00:10, 10 May 2008.
Edit this article
Reddit Digg