Safe Browsing Part 2, Protecting Your E-mail

Stopping e-mail address harvester bots from stealing your e-mail address.

Spider Bots

If you have a web site then you most likely have an e-mail address on your site. Your aim with providing an e-mail address to your site visitors is simple: to allow them to communicate with you on genuine matters. You do not want to have your address abused by spam, placed on a mailing list without your consent and continually bombarded with information you do not need (or want) to know. I have had such an experience with an old e-mail account I included on a site a number of years ago, which I was forced to stop using due to excessive spamming. To this day this account continues to receive about 50 junk mails a day!

'Spider Bots' is a term applied to programs designed to follow links through the Net and catalogue web sites, most commonly for search engines. While search engine Bots are to be encouraged, some people have modified this technology to harvest e-mail addresses from web sites and include them in their mailing lists. If you have an online e-mail address and begin to receive unsolicited junk mail, it is possible that you have fallen victim to such a nuisance.

The Solution

Traditional mailto links are set up in the following way:

<a href="mailto:your@address.com"></a>

When the user clicks on the link their default e-mail tool is opened and 'your@address.com' is entered into the send-to field. It is this format that the Spider Bot is programmed to recognize and collect. Using JavaScript you can achieve the same on-screen result in a manner designed to confuse the Bot, therefore protecting your online privacy:

<SCRIPT LANGUAGE="JavaScript">
// protects e-mail from bots
user = 'your';
site = 'address.com';
document.write('<a href="mailto:' + user + '@' + site + '">');
document.write(user + '@' + site + '</a>');
</SCRIPT>

Simply place this script in the same position in your document as your normal mailto link (i.e. where you want your address to appear). Replace 'your' with your e-mail login name and 'address.com' with your e-mail domain name, and there you have it, a simple solution to an online headache.

John Collins

I have been writing about web technology and software development since 2001. I am the developer of the Alpha Framework for PHP, and the five.today personal productivity app. I love open source, technology, and economics.