Mail harvesters seem to crawl a lot of websites nowadays and people try to fight it. I'm not exactly aware of how these bots scan, but it seems like they're pretty dumb in most cases. For example, they don't allow the "+" sign in usernames. But to make it a little harder for them, why not obfuscate your entire mailto: link in your HTML?

The following code (yes, it can made a little more golf-like) can help you out to "obfuscate" your mailto: link

It takes one parameter, the email address itself. Example usage:

$ ./link_obfu foo@bar.invalid <a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#102;&#111;&#111;&#6 +4;&#98;&#97;&#114;&#46;&#105;&#110;&#118;&#97;&#108;&#105;&#100;"> </ +a>

Browsers (Firebird and Lynx tested) don't seem to have a problem with it, but a simple harvesting bot won't know what to do with it ;)

#!/usr/bin/perl -w use strict; print "<a href=\"&#109;&#97;&#105;&#108;&#116;&#111;&#58;"; foreach (split("",$ARGV[0])) { print "&#".ord($_).";"; } print "\"> </a>\n";

Replies are listed 'Best First'.
Re: mailto: "obfuscation"
by dominix (Deacon) on Feb 07, 2004 at 20:55 UTC

      *oops* I should have seen your snippet (and reply to that) before I posted mine, my humble apologies. I do however think it's nicer to "encode" the "mailto:" part too, not just the address. If you don't do it, you give spammers a hint. "Hey harvester! Here's a mailto link that you probably like, but I 'encoded' it". This way, you tell them, "Hey, here's /a/ link. Might be a mailto: link, might be something else" ;)

      Besides that, I think a module is kinda overkill, since there's ord ;)

      --
      b10m

      All code is usually tested, but rarely trusted.