MIT

Academic Web Page Creation Guide

Web Guide is no longer being maintained and the information on this page may be out of date. For assistance with managing course materials, please visit MIT's Stellar course management system.


Building Your Pages > Making Your Pages Interactive > Replies by Email

Replies by Email with mailto:

On your course Web pages you can include an email link, using mailto:, for students to contact you, one of your assistants, or any email list, with questions or comments.

The mailto: is a URL scheme (like http: or ftp:) that specifies an email address. When a mailto: link is selected, the browser opens an email message window in which the reader can type a message and send it to the email address, which is automatically filled in with the address(es) in the mailto:.

Examples of mailto:

The format is:

<a href="mailto:username@hostname">username@hostname</a>

The following format provides a specific identification of to whom the email is being sent:

Questions or comments to <a href="mailto:f_l@mit.edu">Faculty Liaisons</a>.

The preceding appears on the Web page as:

Questions or comments to Faculty Liaisons.

Multiple email addresses, separated by commas, can be included with mailto: , e.g. mailto:f_l@mit.edu,themtoo@example.com

A more complicated mailto: could also set the subject for the mail message, or even give part of the body of the message, as shown below.

<a href="mailto:ccount@mit.edu,mailtome@example.com?cc=test@example.com&amp;subject=This%20is%20the%20subject&amp;body=and%20this%20is%20the%20body">Mail Me</a>

The preceding appears on the Web page as Mail Me. When clicked, the email window shows the addresses , subject line, and message automatically filled in.

Note: This may not work for all browsers or browser configurations.

Also note, an ampersand (&) in the mailto: must be written as &amp; for the file to be valid HTML. This is because & is a special character in HTML, used for named entities (e.g. &amp; for &, &lt; for < and &gt; for >).

For a detailed specification of more complicated formats, see The mailto URL scheme (RFC 2368).

The mailto: link can also be used in a FORM action.

Another use of mailto: is in the <HEAD> of a Web page to identify the page's creator, as follows:

<link rev="made" href="mailto:username@hostname">

In this example, rev defines a reverse relationship. A link from document A to document B with REV=relation expresses the same relationship as a link from B to A with REL=relation. REV=made is sometimes used to identify the document author, either the author's email address with a mailto URL, or a link to the author's home page.

Cautions Against Using mailto:

In a word, email spam. The mailto: link is an excellent way of advertising your email address and making it convenient for people to reach you. It is so convenient, in fact, that a robot can do it, which "bulk" emailers will use to prepare a list of addresses to which to send unsolicited email.