This always seems to be a sore subject among webmasters, and I have seen some quite silly contrived solutions:

  • addy@DELETE_THISdomain.com
  • mayemail @ mydomain com
  • Please contact us for contact information

To me, these seem very creative (except for the last one which was really kind of a joke).

I have found and implemented a solution on my server that seems to work very well for eluding this issue. It’s a little piece of javascript I like to call menc.js.

Here is a look at the code for the foolwrite function:

function foolwrite(a,b,c,d){
var mail;
var linkname;
var link;

mail=a+”@”+b+”.”+c;
linkname=’Contact’
if(d == 0){
document.write(mail);
} else {
link=’<a href=”mailto:’+mail+’”>’+linkname+’</a>’;
document.write(link);
}
}

As you can see, the function takes three arguments, which are the address, the domain, and the tld. From there, it builds a mailto link from the three pieces, and returns the link. You can also change the linkname variable to something custom, such as “webmaster” or ‘<img src=”path/to/file.jpg”>’ or something like that. The cool thing is that the source doesn’t have a scrapable address anymore. :)

To implement this function, you can either embed it directly, or call it from an external file, as I did, in the same way that you would use any regular javascript. In your code, simply place this line in the place where you would normally put your mailto: link:

foolwrite(“email”,”domain”,”tld”);

Don’t forget to enclose it in <script> tags.

And there you have it! This will prevent any screen-scraping-caused-spam that you may be receiving from your sites, and still allow customers to click and send you mail. This means you don’t have to have any forms that can easily be compromised!

/cs