Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Usage Milestone: Google Analytics Module google_analytics crossed 1,000 active installs. Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Release: GraphQL Compose Codegen 1.1.2 Minor update available for module graphql_compose_codegen (1.1.2). Release: Mapy.com 1.1.3 Minor update available for module mapycom (1.1.3). Release: Ckeditor5 entity browser 3.0.3 Minor update available for module ckeditor5_entity_browser (3.0.3). Release: Ckeditor5 entity browser 3.0.1 Minor update available for module ckeditor5_entity_browser (3.0.1). Release: Ckeditor5 entity browser 3.0.2 Minor update available for module ckeditor5_entity_browser (3.0.2). Release: Teamleader Integration 4.0.2 Minor update available for module teamleader (4.0.2). Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Email Obfuscation Response Filter

28 sites Security covered Drupal 10–11
View on drupal.org

This module protects email addresses from being scraped by search engines and spambots. It obfuscates emails found in mailto links by reversing them and using JavaScript to reveal the original address on user interaction. Other emails are obfuscated by inserting hidden text, making them unreadable to bots but visible to humans once rendered.

The Email Obfuscator (a.k.a. Email Obfuscation Response Filter) uses an event
listener for each generated response to search for emails using regexes. The
emails are obfuscated depending on where the text is found, helping to prevent
email scraping and reduce spam.

Obfuscations

Example: <a href="mailto:[email protected]">

  • The email string excluding mailto: is reversed,
    e.g. <a href="mailto:moc.liame@tset">
  • An onfocus and an onmousedown JS listeners are added inline; these will
    revert the email address following the mailto: prefix back to its original
    form. These two events cover the following cases: right-click, left-click
    and focus with tab.
    Note that:
    • onfocus would do it for most browsers, but Safari needs onmousedown
    • Reverting the already reversed email is only done once in a page load

All other Emails

Example: <a>[email protected]</a>

  • A span with display:none containing a text with delimiters that are invalid
    email characters is added in the middle of the email, e.g.
    <a>test@<span style='display:none'>!zilch!</span>email.com</a>

Exclusions

  • Any email that is invalid (according to PHP's filter_var function)
  • Everything in the backoffice (admin pages)
  • Emails inside HTML-attributes (placeholder attribute for input fields)
  • Exclude Ajax webform request:
    • Because Ajax is usually used when sending a web form.
      This means that the request does not contain HTML, but a JSON object in
      which HTML is encoded with Unicode.
      The regex does not apply here and it is not necessary to obfuscate this
      email address as it is added by the sender.
  • Content in routes that are whitelisted (see below)

Whitelisting Routes

  • Define whitelisted (excluded) routes in settings.php
        $settings['email_obfuscator'] = [
         'ignored_routes' => [
           'rest.api_layout_footer.GET',
           'editor.link_dialog'
         ]
       ];
    

    For these routes, no obfuscation will take place.

  • IMPORTANT: If you are using CKEditor 4 you should whitelist the route editor.link_dialog to avoid
    obfuscating the email in the CKEditor link dialog.

Disabling use of data-nosnippet

  • The attribute data-nosnippet is used by default, to disable displaying the $displayNoneText in search results.
    It is possible to disable it in settings.php
       $settings['email_obfuscator'] = [
         'use_datanosnippet' => FALSE,
       ];
    
  • IMPORTANT: The data-nosnippet attribute is officially supported ONLY by the Googlebot. Support from other bots is not guaranteed.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
4
Tracked since
Jun 2025
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 4
Maintenance
Dormant

Release Timeline

Releases

Version Type Core Release date
1.0.1 Stable 10–11 Aug 29, 2025
1.0.0 Stable 10–11 Jul 2, 2025
1.0.0-rc1 Pre-release 10–11 Jun 20, 2025
1.0.x-dev Dev 10–11 Jun 19, 2025