Sams Teach Yourself HTML 4 in 24 Hours

Sams Teach Yourself HTML 4 in 24 Hours

By Dick Oliver

Linking Your Email Address into a Web Page

In addition to linking between pages and between parts of a single page, the <a> tag allows you to link to your email address. This is the simplest way to enable readers of your Web pages to "talk back" to you. Of course, you could just tell them your email address and trust them to type it into whatever email program they use if they want to say something to you. But you can make it almost completely effortless for them to send you messages by providing a clickable link to your email address.

An HTML link to my email address looks like the following:

<a href="mailto:dicko@netletter.com">Send me an email message.</a>

The words Send me an email message will appear just like any other <a> link (as underlined text in the color you set for links in the link or vlink attributes of the <body> tag). When someone clicks the link in most Web browsers, she gets a window in which to type a message that is immediately sent to you.

If you want people to see your actual email address (so they can make note of it or send a message using a different email program), type it both in the href attribute and as part of the message between the <a> and </a> tags.

For example, the HTML in Figure 7.7 is an email directory page for a club of aging German philosophers. (I know that Wittgenstein's English, but he was born in Austria, so they let him in the club anyway.) The resulting page in Figure 7.8 lists the club officers with a clickable email link for each.

07fig07.gif

Figure 7.7 Links to email addresses use the same <a> tag as links to Web pages.

07fig08.gif

Figure 7.8 The mailto: links in Figure 7.7 look just like http:// links on the page.

When someone clicks the top link in Figure 7.8, a separate window (see Figure 7.9) opens; the window has spaces for a subject line and email message. The email address from the link is automatically entered, and the user can simply click the mail button to send the message.

07fig09.jpg

Figure 7.9 Clicking the top link in Figure 7.8 brings up this email window (or the email software set up on your computer).

Share ThisShare This

Informit Network