Drupal – Encoding Email Addresses to Deter Spam-bots

While working on my latest Drupal project, I really wanted an easy, brainless way for users to create clickable “mailto:” links that gave pesky spam-bots a hard time.

Turns out, the Bbcode module does just the trick. Even if you don’t normally use it, you can add this input filter to your standard HTML filters, and it will work. The first step is to download and install the module.

Next up, enable the module, and add it to your input filters (located at /admin/settings/filters):

input-filters.png

As you can see,  you don’t even need to assign it any roles. However, the Filtered HTML and Full HTML filters can use it, just set them up like so:

Input Filters

Next, go in and and configure the Bbcode module to encode email addresses:

bbcode-email.png

Now, to use it – just use the standard bbcode to encode any email address:

[email]someone@domain.com[/email]

And when the page is rendered, the underlying HTML will all be JavaScript gobbly-gook, but to the end user, it will be a normal link.

3 thoughts on “Drupal – Encoding Email Addresses to Deter Spam-bots

  1. This is very helpful. The encoding of the email address can be handled automatically by enabling the option: “Convert addresses to links” in addition to “Email address encoding.”

    Most users are not going to know what bbcode is and will be confused by instructions to use some other markup language.

    When I installed this on Drupal 6, the layout was different…there is no separate module for bbcode, it is simply built into the filters for the “input formats” (there is no such thing as a filters module either). All configuration is done from Site Configuration -> Input Formats, then configure the Filtered HTML format to check off the BBCode options…

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>