And another tip I just recently learned was to 'encode' the html email link by using HTML Ascii encodings (like A or some such).. Does anybody have some handy code to perform some translations in perl?

This part you can do with HTML::Entities.

As for the auto-image-generation stuff, I've never done that, so some other monk will have to answer that part. Though, if it were me, I'd just do an image for each major TLD and use the entity encoding for the rest of the address.

my %tldgif = ( '.com' => ['commercetld.gif', $comwidth], '.org' => ['organisationtld.gif', $orgwidth], '.net' => ['telcotld.gif', $netwidth], '.us' => ['usatld.gif', $uswidth], '.uk' => ['gbtld.gif', $ukwidth], '.au' => ['aussietld.gif', $auwidth], ); sub encode_email_address { my ($addy) = @_; my $tld = ""; for (keys %tldgif) { if ($addy =~ /$_$/) { $tld = "<img src=\"$tldgif{$_}[0]\" alt=\"[$tldgif{$_}[0]]\" height=\"$tldheight\" width=\"$tldgif{$_}[1]\""; $addy =~ s/$_$//; } } use HTML::Entities; my $charstoencode = join '', ('A'..'Z','a'..'z','<>"&@',0..9); return (encode_entities($input, $charstoencode).$tld); }

That's untested, and I get tired in the evening, so it may need a slight fixup or two, but it should give you the idea. Once again, if you want to generate the images on the fly for each address, you'll need to wait for another monk to answer, who has more experience with such things.

As Zaxo says, spammers can easily use HTML::Entities if they decide it's worth their while, which they will if all the email addresses on the web are encoded with entities. The image helps more, because OCR is imperfect and takes more time than entity decoding; there are no known documented cases yet of spammers using OCR to harvest email addresses from images. This doesn't mean they can't or won't, or even that they haven't, but it's not currently a common practice. There are other tricks, like putting swirley colors in the background of the image and stretching and distorting the text, to make it harder for OCR software to read, hopefully without making it too hard for a seeing person. If you want to pursue that sort of shenaneghans, do a web search for CAPTCHA.


$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/

In reply to Re: Email anti-harvester code by jonadab
in thread Email anti-harvester code by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.