Keep yourself safe from spammers. Encode your emails while displaying.

c# Feb 2, 2014

So, you have opened your inbox and you see those dirty emails offering you buy something or grow something and the number keeps increasing day by day. You will notice that they are from unknown sources, the sites you never know or registered on. You guess it right they are spammers, but how did they get your email address?

It is a common practice that you leave your emails in forums, blog comments, websites the way you write everywhere else name@domain. Writing emails in plain text opens doors for spammers because they use malicious tools like email scrapers that grab emails from website source. They are in search of email addresses and plain text email addresses are more likely to be spammed.

Then how to deceive those malicious bots from scraping your emails? Here is a reliable option that works for me and can be done via server side script so less prone to errors

Convert the email address to HTML entities

e.g., me@example.com will appear as me@example.com in HTML source.

Following are few other methods to deceive email scrapers

Reverse the text direction

This method makes use of unicode-bidi and direction properties.

e.g., me@example.com will be written in HTML as
<span class=”reverse”>moc.elpmaxe@me</span>
and use the following CSS rule to display it
. reverse { unicode-bidi: bidi-override; direction: rtl; }

Add brackets

This method uses brackets ()/[]/{} to display an email. The email displayed reads the same but not actual email address.

e.g. me(at)example(dot)com

Add some dummy text

It works by inserting dummy text into email address. The email address is broken into parts and dummy text is inserted to fool email scrapers and while displaying dummy text is hidden via CSS.

e.g., me@example.com can be written as
<span class=”dummyemail”> me<span>foo</span>@<span>bar</span>exam<span>foo</span>ple.<span>bar</span>com</span>

and following CSS rule will make it appear like a plain email address
.dummyemail span{display:none}

Tags