Email obfuscation techniques are used to hide email address from spammers. They're used to show email addresses in web pages without the risk of exposing them to spam bots which constantly crawl the web harvesting for them.
In this article, I'll describe 3 techniques I've used to obfuscate email address.
1. Obfuscating the HTML code
<span>u</span><span>s</span><span>e</span> <span>r</span><span>@</span><span>e</span> <span>x</span><span>a</span><span>m</span> <span>p</span><span>l</span><span>e</span> <span>.</span><span>c</span><span>o</span> <span>m</span>
The <span> tags are optional but add an extra layer of complexity for spam bots trying to discover email address inside the page code. The advantages of this method is that the email is displayed seamlessly, in the same font as the rest of the text. However this is not a very effective method since most bots do automatic HTML entities translation on the fly removing <span> tags and HTML entities.
2. Using server side code
This one consists in using a server-side script (such as PHP) for generating an image containing the email that you want to display. This is the technique I use in my company website and is much more effective than the first one, although it doesn't display the email in the native page font, so the email will look more or less awkward depending on how different are the server font from the client browser font.
So, instead of inserting the email you would insert something like:
<img src="http://insophia.com/email.php?u=prh" />
Here is the source code of ths script I use in insophia.com (written in PHP using the GD imaging library).
As you can see, the email is not contained in the code at all since the script already knows the domain and automatically adds it. That's what makes this method so effective.
For example, if you want to display the email "firstname.lastname@example.org" you would insert a piece of code like this in your HTML: