Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to obfuscate an e-mail address on a website?

I've spent the past few days working on updating my personal website. The URL of my personal website is (my first name).(my last name).com, as my last name is rather unusual, and I was lucky enough to pick up the domain name. My e-mail address is (my first name)@(my last name).com. So really, when it comes down to guessing it, it's not very hard.

Anyways, I want to integrate a mailto: link into my website, so people can contact me. And, despite my e-mail address not being very hard to guess, I'd rather not have it harvested by spam bots that just crawl websites for e-mail address patterns and add them to their database.

What is the best way for me to obfuscate my e-mail address, preferably in link form? The methods I know of are:

<a href="mailto:[email protected]">e-mail me</a> 

It works, but it also means that as soon as my website hits Google, I'll be wading through spam as spam bots easily pick out my e-mail address.

<img src="images/e-mail.png" /> 

This is less desirable, because not only will visitors be unable to click on it to send me an e-mail, but smarter spam bots will probably be able to detect the characters that the image contains.

I know that there is probably no perfect solution, but I was just wondering what everyone thought was best. I'm definitely willing to use JavaScript if necessary, as my website already makes use of tons of it.

like image 707
Adam Rezich Avatar asked Apr 14 '09 18:04

Adam Rezich


People also ask

How do I obfuscate an email address to my website?

Changing email format The most common method is to replace '@' character with [at]. It's fairly obvious to just about anyone what the correct address is and bots looking strictly for email addresses will get confused. It also can be implemented within seconds, without any code.

How do I mask an HTML email?

You can use the ::before and ::after pseudo-elements in CSS to insert the email username and domain name on either sides of the @ symbol. The bots, which are generally blind to CSS, will only see the @ sign while browsers will render the complete email address which, in this case, is [email protected].

Is it safe to display email address at website?

Putting an email address on your website actually takes away the security aspect Google considers when searching your website. Trolls, people who visit websites using search bots, look for exposed email addresses they can “harvest” in order to send spam, or worse, steal identities.


2 Answers

I encode the characters as HTML entities (something like this). It doesn't require JS to be enabled and seems to have stopped most of the spam. I suppose a smart bot might still harvest it, but I haven't had any problems.

like image 164
chroder Avatar answered Sep 24 '22 08:09

chroder


Personally, I've given up on hiding my email address. I find it easier to look into better spam-filtering solutions than worry about obfuscating. You could spend days trying to find the best way to obfuscate your address, and then all it takes is one person to sell your address to a spammer and all that work was useless.

like image 22
Chad Birch Avatar answered Sep 24 '22 08:09

Chad Birch