WebDevelopersNotes logo

home-icon Home / HTML / Protecting email address on web pages from spambots

Protecting email address on web pages from spambots

Protecting email address on web pages from spambots

This tip will help you in protecting your email address from spambots. Avoiding spam is not easy and there are several steps you can take to stop spam. However, this tip describes just one of ways of protection against it. The tip describes how to prevent spambots from picking your email address from your web site.

What is ‘spam’ and how to they get your email from a web page?

SPAM is unsolicited email. It’s something you never asked for and most of the times, it’s garbage!
When you include a mailto tag in a web page, you expose your email to spammers. Getting an email address from a mailto tag is quite easy. You would have noticed that email addresses follow a set format. Spambots are spider like programs that move around on the internet checking HTML documents for this format. When they find it, they extract the email address and store it for their diabolical needs.

But there is a way to fool spambots. If you write the email address as a series of special characters, instead of alphabet, it’s highly unlikely that spambots would be able to pick it up.

Each lowercase alphabet has a corresponding special character that we call a Character Entity. In addition to lowercase alphabet, there are special characters for @, the underscore, the period and the hyphen. You can find the full list of HTML Special Characters of Character Entities in the Web Design section.
Each special character starts with an ampersand sign, followed by a hash, then a specific numeric value and ends with a semicolon. Thus, the special character for a is a for b is b and so on.

Now if you have an email address like bard@somewhere.com, you should write it as a series of special characters:

This looks really messed up.. but that’s the price you have to pay to protect yourself from spam.

However, the above method is not foolproof. Addition of a few lines of code to the spambot can ensure that the script searches for email addresses in both human and character entity formats. The safest way to display an email address on a page is to use it as an image or a Flash file. However, with images if you use mailto, the purpose is lost. So a Flash file would be the best.
Update: Google search engine can now read flash files so I guess spambots would be able to read these too (if not now then sometime in the near future).
So what are you left with? – Use HTMl forms and server-side programming to receive visitor inputs.

Sponsored Links

Your comments
Star icon IMPORTANT Have a question / problem? Click here to ask an expert.

Sponsored Links


How do I view a deleted web page?
Is there a way to view a deleted web page - one that is no longer available? Yes there is and the solution is quite simple. [more...]


YouTube was serving more than 2 billion videos each day in March 2010. By January 2012, more than 4 billion videos per day were being watched on YouTube. [more...]