Carnegie Mellon University Website Home Page
 

Spam Filtering for Webpages

The "mailto:" Tag

Spam Robots or Spiders "crawl" the internet searching for "mailto:" tags. To create a clickable "mailto:" hyperlink that is mostly spam resistant, use the following JavaScript on your web pages.

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
user = "myusername";
site = "myhost.com";
document.write('<a href=\"mailto:' + user + '@' + site + '\">');
document.write('Email Our Department' + '</a>');
// End -->
</SCRIPT>

Steps to create a clickable "mailto:" hyperlink:

  1. Copy and insert the above JavaScript into your HTML source code at the mailto: insertion point.
    Note: Some HTML authoring tools may require you to use an automated tool for inserting the JavaScript (e.g., Insert > Script Object in Dreamweaver).
  2. Edit the script to include the user name and mail host.

    For example, suppose email should be sent to juser@andrew.cmu.edu. Within the script, the lines that read:
    user = "myusername";
    site = "myhost.com";

    Change to:
    user = "juser";
    site = "andrew.cmu.edu";
  3. Save your HTML file. The JavaScript will generate a clickable link that reads "Email Our Department."

Spam-Resistant List of Email Addresses

If you must maintain a web page of email addresses, restrict it to one page. You can limit the number of SpamBots from indexing the page with the following meta tag:

"meta name="Robots" content="noindex,nofollow"

Most SearchBots, SpamBots & Web crawlers ignore pages with this tag.

Last Updated: 10/14/10