How to Spam-proof a Mail:to Email Address

Spamproof Email Link

There are tons of methods out there to spam-proof a mail:to link. While no method is completely spam-proof, some of the methods out there just don’t make any sense.

1. The Wrong Way

<script>document.write('<a href="”></a>);</script>

This code was found under several articles on how to spam-proof a mail:to link. The obvious problem with this method is that most email harvesting bots download the source code of a webpage, in which the email in this code is clearly displayed as “”. Any script that uses your email in plain text is entirely ineffective against email harvesting bots.

2. The Complex Way

<script language="JavaScript"> 

var name = "FIRST PART"; 
var atsign = "@"; 
var virtual_domain = "DOMAIN"; 
var dotcom = ".COM"; 

document.write("<div align=center>SEND ME AN EMAIL, "); 

document.write("<a href=mailto:", name + atsign + 
virtual_domain + dotcom, ">YOUR NAME</a>"); 

document.write(", AND I'LL GET BACK TO YOU."); 



We found this method on a few more articles about hiding emails. We didn’t even want to mess with this. Hiding an email shouldn’t be this difficult!

3. The Right Way

<script language="javascript" type="text/javascript">var pre = "example";document.write("<a href='mailto:" + pre + "'>" + pre + "</a>");</script><noscript>Enable javascript to see our email.</noscript>

Short and sweet. This example is protecting; simply replace “example” with the first part of your email, and the two “” parts with the second half.

What People Are Saying:

  1. Chimpanzee says:

    I understand that you’re trying to make it simple, but surely the simpler it is the easier it is for spambots to workaround it. Once a spambot author sees this post they could fairly easily make some changes to the bot to look for this javascript and extract the email address from it.

    Mind you, I’m not saying the complex example you gave is any more secure either, just that neither is all that effective.

Leave a Reply

Copyright 2024, All rights reserved. Yadda yadda.