Email Obfuscation

Spam sucks. Here's a few things we can do to prevent it. 

Here's a nice article about the topic: http://alistapart.com/article/gracefulemailobfuscation

Drupal

There are a few different ways that email addresses can end up on a Drupal page and as such there are a few different methods to protect them.

l() function

For mailto links that were generated using Drupal's l() function, the RC4 Email module works well. 

Original
<a href="mailto:example.one@example.org">Send email to example.one@example.com</a>

Obfuscated for bots
<a href="mailto:example ! one () example ! org" data-emailurl="H5NkTqSWw54048Y34paoxxdCTz5/yAKUavP6XcL7ZeB24tB4" data-textenc="MYBsVbaWi5lm1dQz4IW/nQVV" class="rc4_email">Send email to example ! one () example ! org</a>

 

One thing to note is that when inspecting the page you won't notice any difference—it will look just like a normal mailto link. However, if you view the source you will see something similar to the 'obfuscated for bots' example above.

Text format

To obfuscate email addresses in a text field it looks like Invisimail is the way to go. It provides an input filter that can be added to any text format (admin/config/content/formats) on your site in order that email addresses in typed into text fields get obfuscated. It provides Javascript based obfuscation as well as a method that uses HTML entities.