How to Prevent Spam Bots From Collecting Email Addresses

Written on June 23, 2008 – 4:11 pm | by Hii Hiong Ching |

As I mentioned before in How to Include Subject, CC, BCC, and Email Body in Email Links, you are creating a risk to get spam if you simply placing email addresses on a page without encoding them.

Some websites using “[at]” to replace “@” and email will look as “name [at] domain.com”. This is a good idea for personal websites since nobody challenge you. In commercial, many clients wouldn’t allow you to use “name [at] domain.com” this format. They are not web designer and they don’t understand how spam prevention works, or even care for that matter.

I have this method originally from david walsh blog. Its author have a quick PHP script that you can use when putting raw email addresses on a page:

The Function

function encode_email($e)
{
	for ($i = 0; $i < strlen($e); $i++) { $output .= '&#'.ord($e[$i]).';'; }
	return $output;
}

Usage

echo(encode_email('email@office-it.org'));

The above function takes a string input (the email address), loops through each character replacing the letter with the character’s ASCII value, and returns the encoded email address. That’s all you need to do!

Another method (much simple) is found at SOLMETRA. It is a tiny JavaScript code which will encode email for you.

The disadvantage for second method is if you have a page with hundreds of addresses, the page download will be bloated.

I am not guarantee methods above is bulletproof solution, but it is, at least, a basic protection.

Popularity: 53%

Share and Enjoy:
  • Digg
  • del.icio.us
  • StumbleUpon
  • Facebook
  • Google
  • YahooMyWeb
  • Netvouz
  • description
  • ThisNext
  • MisterWong
  • Wists
  1. 1 Trackback(s)

  2. Jun 24, 2008: How to Include Subject, CC, BCC, and Email Body in Email Links | Office-it.orG

Post a Comment

About Office-it.orG

This is a site to share my knowledge, discovery and experience related to my hobby and work. Most articles on this site are related to web design, web development, graphic design, short reviews, tips and tricks. I sometimes write some about Microsoft Office Application too.

Want to subscribe?

RSS Subscribe in a reader Or, subscribe via email:
Enter your email address:  
Find entries :