Hide E-mail Addresses From Spammers

Everyday, e-mail spambots crawl the Internet in search of any and every e-mail address they can find. They scan your chat rooms, blogs, forums, guest books and website contact pages. Is your e-mail address protected from these evil bots? This article shows you how to hide your e-mail address from spambots while still keeping it visible to people.

How Do I Know If I’m Protected?

Most spambots work by searching for the @ character in your website source code and grabbing the characters listed on each side in hopes that it is a valid e-mail address. Even if your e-mail address is not visible on a website, if you use a mailto link or a form that submits data to your e-mail, your e-mail still may not be protected. (Some outdated forms have a field in the source code that contains the e-mail address to send the form to.) To see if your e-mail address is protected, go to your webpage, right click on the page and click on View > Source. In the window that opens up, go to Edit > Find, and do a search for your e-mail address. If you can see your e-mail address in the source code, so can spambots. Here’s what you can do to hide it.

Replace the @ and . Symbols

One method people use to hide their e-mail is to replace the @ symbol with the word “at” and the period with the word “dot,” so your e-mail would look like: name at gmail dot com. The problem with this method is that you cannot make this link clickable with a mailto link because the link will need to contain your actual e-mail address. Also, since this is a common method, some smarter spambots may still be able to find it. This method is good when posting in blogs or forums where you can’t use script tags to hide your e-mail, but it should be avoided unless absolutely necessary.

Mask Your E-mail Address

Masking an e-mail address involves adding words or phrases to your e-mail address that humans will know to take out. For example, your e-mail could look like: name@gmail.com.removeme or name@REMOVE.gmail.com. However, this method has the same issues as the first method.

Use an Image

Putting your e-mail in an image will keep spammers from seeing your e-mail. The problem with this method is that users can’t copy and paste the e-mail address, and you still can’t use a mailto link.

Encode mailto: and the @ Symbol

Each character has HTML code that can be used in its place. By replacing the mailto: and the @ symbol with html characters, spambots will not be able to locate the e-mail address, and you can still have an e-mail link. Your code would look like this: <a href = "&#109;&#097;&#105;&#108;&#116;&#111;:name&#064;gmail.com" >E-mail Me</a>.

Use Javascript

The method I typically use is coding the link and e-mail address with Javascript. There are different methods of doing this, but this is one common way.
<script language=JavaScript>   
var user = "name";   
var hostname = "gmail.com";   
var link = user + "@" + hostname;
document.write("<a hre" + "f=ma" + "ilto:" + user +    "@" + hostname + ">" + link + "</a>");
//—>    </script>
This script displays the e-mail address with the e-mail link enabled. However, any users with Javascript disabled in their browser will not be able to view the e-mail address.

What about Forms?

While the methods above are used to display an e-mail address on a page, a form that displays your e-mail in the code requires a different solution. If your form requires a hidden recipient field to function, then the best remedy is to use a different type of script. There are several formmail scripts out there, but if you don’t have any experience in html, you should consider hiring a web developer to change the code for you. Without knowing your specific server and some other info, I can’t go into much detail. Just know that if you see your e-mail address in the source code, you should find a way to hide it.

A Note to Expression Engine Users

If you are using Expression Engine for your content management, there is a built in variable that you can use to hide your e-mail and display a link. It looks like this: {encode=“name@gmail.com” title=“name@gmail.com”}. E-mail address links that are generated by Expression Engine will be encoded automatically.

In Summary

Hiding your e-mails from spambots will reduce the risk of spam, however none of the techniques are guaranteed to prevent spam. The best thing you can do is to keep your primary e-mail address private and use contact forms that hide your e-mail address.

Bookmark and Share



Donna said on July 17, 2010:

Someone which I do know who it is in my opinion has my email address & has had emails sent to me by using my email address from other people& it has been masked.

Post a comment