Carnegie Mellon University

Advanced Topics

Spam bots, spiders, and crawlers search the internet for "mailto:" tags. The following script can help protect your "mailto:" tags.

  1. Copy and insert the following JavaScript into your HTML source code at the mailto: insertion point.
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    user = "myusername";
    site = "";
    document.write('<a href=\"mailto:' + user + '@' + site + '\">');
    document.write('Email Our Department' + '</a>');
    // End -->
  2. Edit the script to include the user name and mail host.
    For example, if the email will be sent to,
    in the script, change these lines:
    user = "myusername";
    site = "";
    to these lines:
    user = "YourAndrewID";
    site = "";
  3. Save your HTML file. The JavaScript will generate a clickable link that reads "Email Our Department."

Note: Some HTML authoring tools require you to use an automated tool for inserting JavaScript (e.g., Insert > Script Object in Dreamweaver).

If you maintain an email list web page, restrict it to one web page, if possible. To make that page spam-resistant, add the following line to your HTML code. Compliant search engine bots, spambots, spiders, and Web crawlers ignore pages with this tag:
<meta name="robots" content="noindex,nofollow" />