Producing web pages
* HTML CSS DHTML XHTML A to Z of tags        Accessibility          Design

Using a link to send email

You can have a link that allows visitors to send email from your website. This can be a useful addition to your site; it makes it easy for your visitors to send questions or comments.

You make an e-mail link in much the same way as links to other pages. You using the href attribute of the <a> but include the mailto attribute in a link:

<a href="mailto:a.gilliver@lineone.net">Ann Gilliver</a>

The e-mail program then opens a new email with your address already in the To: field. If you want to send mail to more than one person, use semicolon to separate the addresses.

Some browsers and mail clients allow you to specify the content of various fields so that they are automatically filled in.

subject The text to appear in the subject line
body The text to appear in the body of the message
CC Addresses to include in the cc (carbon copy) section
BCC Addresses to include in the bcc (blind carbon copy section

Here is an example with a subject supplied:

Contact <a href="mailto:a.gilliver@lineone.net?

subject="Subscribe to mailing list">Ann Gilliver</a>

Suppose you want an email link for your visitors containing specific text in the body of their message, simply add:

<a href="mailto:a.gilliver@lineone.net?
body="Send me a copy of your brochure">Send Email</a>

Use a question mark to separate the address from the fields and an ampersand to separate each field. For example

<a href="mailto:a.gilliver@lineone.net?
subject="Subscribe to mailing list"&
body="Send me a copy of your brochure">Send Email</a>