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="mailto:example@abc.com”>example@abc.com</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 “example@abc.com”. 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."); 

document.write("</div>"); 

</script>

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 + "@abc.com'>" + pre + "@abc.com</a>");</script><noscript>Enable javascript to see our email.</noscript>

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

Comments:

  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 2020, All rights reserved. Yadda yadda.