How to Prevent Spam Bots From Collecting Email Addresses
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%












1 Trackback(s)