Drupal is a registered trademark of Dries Buytaert
drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14). node_revision_delete 2.0.3 Minor update available for module node_revision_delete (2.0.3). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2). geofield_map 11.1.8 Minor update available for module geofield_map (11.1.8).

obfuscate_email

3,276 sites Security covered
View on drupal.org

Protect email addresses from spam bots, in two situations:

  1. In a field template, or
  2. in a text filter for ckeditor output

Both situation utilize the same javascript.

Upgrading to 2.1.x

Ensure you have uninstalled the rot13 submodule prior to upgrading as it is no longer required. See Release Notes

How it works?

To hide your emails from bots, render a non readable email on the server and
decrypt it via vanilla JS in the client. No jQuery needed. The basic idea consists of three parts:

  • hide behind a data-attribute
  • substitute the @-sign and dots (.) with /at/, /dot/, then
  • shift everything via rot13
  • rebuild it via javascript

Notice: There is no non-javascript fallback to this method!

How to use the template

Have a look into template/field--email.html.twig to have a fully working
example. This template will be used when the module is enabled. Use the
drupal suggestion system to override this default template. The JS is attached
to the page.

<a data-mail-to="znvy/ng/znvy/qbg/pbz">Email</a>
<a data-mail-to="znvy/ng/znvy/qbg/pbz" data-replace-inner="">Email</a>
<span data-mail-to="znvy/ng/znvy/qbg/pbz" data-replace-inner="@mail">drop me a line at @mail</span>

will be converted to

<a href="mailto:[email protected]">Email</a>
<a href="mailto:[email protected]">[email protected]</a>
<span>drop me a line at [email protected]</span>

Note: Use the data-replace-inner attribute to replace the complete inner text,
or give it a string to only replace this very string.

How to use the text filter

In the backend go to admin/config/content/formats, e.g. Basic HTML, and under
the section "Enabled filters" check the box "Obfuscate Email". So now every
mailto-anchor written in the ckeditor will be preprocessed before rendering and
substituted on the client side.

Source

GitHub: https://www.github.com/WondrousLLC/obfuscate_email

Thanks

Thanks to b_sharpe for adding the text filter.

Activity

Total releases
1
First release
Oct 2025
Latest release
6 months ago
Release cadence
Stability
100% stable

Releases

Version Type Release date
2.1.3 Stable Oct 14, 2025