Obfuscating E-mail Addresses

Events happening in the community are now at Drupal community events on www.drupal.org.
eliza411's picture

I'm looking into various techniques for obfuscating CCK e-mail addresses and addresses in text areas with modules like SpamSpan, theme snippets etc. and would really appreciate hearing what preferences and advice people have on the subject.

Comments

Invisimail

mikey_p's picture

Invisimail http://drupal.org/project/invisimail

This project provides formatters for the CCK Email field and also provides a simple function that could be called from anywhere to encode an email address as ascii codes and optionally use javascript to write it.

Look for the function invisimail_ascii_encode($string, $js = FALSE, $link = FALSE, $text = NULL) with:

 * @param $string
 *   A string which contains only an email addres to be encoded. 
 * @param $js
 *   Optional: A boolean which sets whether Javascript is used for encoding.
 * @param $link
 *   Optional: A boolean which set whether the result includes a mailto link.
 * @param $text
 *   Optional: The text to be used for the link.
 * @return
 *   An ascii encoded email address.

I saw this one but was put

eliza411's picture

I saw this one but was put off by the dev status, which is why I thought I'd try SpamSpan first. Have you used Invisimail in production?

dev status can be misleading

rjleigh's picture

Since there's no hard and fast rule for project naming conventions in Drupal (or in any code development, for that matter), the 'dev status' in a module can be quite misleading.

Some developers race to release status almost immediately, while others leave a module in dev status for perpetuity, despite stability and wide acceptance (maybe because they don't want the 'responsibility' of calling it ready for prime time?).

Look at gmail, still officially in 'beta' status.

In the drupal world, you get used to expecting quality code from certain folks, and you can also check the usage statistics (wide acceptance is usually some indicator of stability, if not pressing need). I also review the issues queue to see if the author is responsive or if there are critical bugs reported and still unaddressed. All of these are important, no matter how the module is labeled - that's the thing about opensource, what you don't pay for with $$, you pay for with invested time.

But with any mod, dev status or not, best always to try it out on a copy of your site and fully test out the features to make sure they're working as you expect.

Check out

grantkruger's picture

Check out http://drupal.org/project/invisimail if you want to hide email addresses from spam-bots. It's a module by Jeff from Lullabot. It looks promising, though I've not used it myself. I found it while looking for another module that I had used. Jeff is a big believer in KISS code (Keep It Simple Stupid). Odds are its a decent module, it it's still dev for 6, so user beware.

The module I used is http://drupal.org/project/contact_forms created by an Australian guy. It lets you have a Drupal contact form for any email, and as I recall, not just emails for registered users, but any email. This lets you have unique content forms for a host of reasons, instead of one contact form with a category select (drop-down) to choose who the recipient is. For example, instead of this:
<a href="contact">Contact Us</a>
You might have
Contact <a href="contact/director">our director</a> or the <a href="contact/webmaster">webmaster</a>.
My personal preference is to use contact forms and to never to show emails.

My experience in this area is limited to a couple of sites though, so I also look forward to other replies.

Grant

Sala kahle,
Grant

Heh, Mike replied as I

grantkruger's picture

Heh, Mike replied as I typed. invisimail is indeed promising.

Grant

Sala kahle,
Grant