Protecting Email on Web Sites

Posted 2003-03-02
If you have web pages on the internet with your email address listed you probably get a lot of spam. The reason is quite simple... Spam list creators use spiders to search web pages for email addresses to add to their spam lists. Once they find a page with your email address on it your added to their lists and distributed to thousands of spammers.

I know first hand about this... One email account I have gets over 450 email per day and 99.99% junk. When I was changing sites(and email) I wanted to make sure this wouldn't happen with my new ID's. I still needed to put my email address on websites I just didn't want all the junk mail. I needed a solution that worked and did not need server side code. The answer was simple... script it! 

Instead of 

<A HREF="mailto:myname@mysite.com">myname@mysite.com</a> 

Use the following:

<A ONCLICK="this.href='mailto:myname'+'@mysite.com'" HREF="#x"><SPAN>myname</SPAN><SPAN>@mysite.com</SPAN></a>

The link looks the same to the user and works, but when spiders come crawling they can't make sense of the address so they skip it.

There are a few "tricks" with this link...

  1. The email address must be split into 2 or more pieces. Without this you are wasting your time.
  2. In order to join the split pieces requires script. I wanted to make sure old browsers did not fail so I put the script in an onclick event. Browsers that do not support script do nothing but the email address is still displayed.
  3. Used <SPAN> tags to separate the displayable text in the link. Could have scripted but this was simpler. 

You can create numerous enhancements including scripting/encrypting the entire link but I wanted a simple solution that works. On my site the concept is the same but I have a few other considerations(like scripted trailers). If you look at the source of this page there is no email link or copyright info defined for the bottom of the page. It is in a different page making it more difficult to trap.

Never put your real email address on NewsGroup postings!!!
This is the #1 place spammers get email addresses. Do what others do... add junk to your address and tell people in the email how to adjust the address properly. It is a pain but much better than getting spam. Example: for me@mysite.com use me@mysitejunk$$.com.  

Hope this helps you stop spam as it has for me. Sorry, it can't reverse damage, just reduce future damage.