Creating a link to e-mail

From Lesson 12 of Maricopa Center for Learning and Instruction (MCLI) Writing HTML

http://www.mcli.dist.maricopa.edu/tut/tut12.html

Now, suppose someone was reading your page and wanted to send you a comment on how nice your page looked. They would have to write down your e-mail address, launch another program, and send you a message. Wouldn't it be great if you could send email from your Web browser? Well, most web browsers now can!

The way to do this is to create a hypertext link with the mailto type in the URL (see lesson 8b for a refresher). Create an email hypertext link like this:


    <a href="mailto:webdude@jade.mcli.dist.maricopa.edu">send an e-mail to alan</a>

When the text send an e-mail to alan is clicked, the web browser will bring up a screen where you can compose a message and send it to me. What's more, you can also insert a default subject line for the e-mail message (NOTE: this may not work on all browsers):


    <a href="mailto:webdude@jade.mcli.dist.maricopa.edu?subject=hi from lesson 12">
       send an e-mail to alan</a>

Try it! Send me a note! send an e-mail to alan Note: Alan is no longer here, so you may not get a reply, or very quickly.

And there is more you can do by adding on to the mailto link. If you wanted to send the same message to more than one address, say the President and Vice-President, you just put the email addresses separated by commas (note that in your HTML code this should be one long line, we have broken it up so it displays better here):

    <a href="mailto:webdude@jade.mcli.dist.maricopa.edu,pres@whitehouse.gov,
         vice-pres@whitehouse.gov?subject=hi from lesson 12">
         send an e-mail to alan, the pres, and the vice-pres</a>

Let's say the Vice-President should only be carbon copied ("cc:") on this message. To do this, just add another string after the subject using cc= and the email address. Note that the Subject= string and the cc= string are separated by a &:

    <a href="mailto:webdude@jade.mcli.dist.maricopa.edu,pres@whitehouse.gov,
         ?subject=hi from lesson 12&cc=vice-pres@whitehouse.gov">
         send an e-mail to alan, the pres; cc: the vice-pres</a>

And lastly, you can try to insert a default message using the syntax body= and the text that should be placed in the body part of the email message window:

    <a href="mailto:webdude@jade.mcli.dist.maricopa.edu,pres@whitehouse.gov,
         ?subject=hi from lesson 12&cc=vice-pres@whitehouse.gov
         &body=Hi there, I think Alan deserves a dinner at your place.">
         send an e-mail to alan, the pres; cc: the vice-pres, with a default message</a>

Please do not try sending these messages! Alan likes e-mail but don't bother the folks in the Whitehouse!