The "mailto:" Tag
How can I avoid using the "mailto:" tag on my website to prevent spam?
Spam Robots or Spiders "crawl" the Internet searching for "mailto:" tags. To create a clickable "mailto:" hyperlink that is 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 me!' + '</a>');
// End -->
</SCRIPT>
This will result in a "mailto:" like this: myusername [at] myhost.com (Email me!)
Steps to create a clickable "mailto:" hyperlink:
- 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).
- Edit the script to include the user name and mail host.
For example, suppose email should be sent to jdoe [at] cs.stu.edu. Within the script, the lines that read:
user = "myusername";
site = "myhost.com";
must be changed to:
user = "jdoe";
site = "cs.stu.edu";
- Save your html file. The JavaScript will generate a clickable link that reads "Email me!"