17 Jun 2005, 10:29am
General
by

Comments Off

Protecting Email Addresses from Malicious Spiders

Malicious spiders can be the reason for spam emails. Any email address given out in the standard user@domain.com is vulnerable. One website where I’ve addressed this issue is the Newsrelease website. This page is especially vulnerable since email addresses of different contacts are published here.

When spam-proofing emails, ideally the following should be satisfied:

  • the email should not be easily retreivable from the source HTML
  • the email should be accessible visually
  • the email should be accessible contextually, ie clickable
  • the technology used in the process should not completely exclude browsers which don’t support the technology or have it disabled, ie offer these visitors an alternative way to read/access the email address

I used the method of spam-proofing the emails offerred in the comments section here. The idea is simpe:

  1. Use javascript to hide the email address inside the source by concatenating parts of the email addresses and then outputting it to the browser using the document.write function
  2. Account for the browsers which don’t support javascript or have it disabled by displaying a phonetic email address

You can see it in action here. This is however a static page and I did not have any trouble with it. You can see that the source does not have the email address in the form user@domain.com. I used two different methods for the two emails so that it can serve as an example of how to do the same thing in two different ways using the php script.

More troublesome were the actual news articles which are dynamically generated such as this one and this one. Because of the way news.php works, I also had to change the way the function that generates the javascript snippet to make it work with changing emails in a huge text block. The actual code can be easily examined in news/news.php, news/reach.php and the function itself in the php include: news/inc/printEmail.php .