Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Drupal 11.4.6 Update released for Drupal core (11.4.6)! Release: Drupal 10.6.16 Update released for Drupal core (10.6.16)! Release: Drupal 12.0.0-alpha1 First alpha version released for Drupal core (12.0.0-alpha1). Release: AI (Artificial Intelligence) 1.5.0-rc3 New release candidate for module ai (1.5.0-rc3). Release: Smart Image Optimizer 1.0.1 Minor update available for module smart_image_optimizer (1.0.1). Release: EzContent API - Enhanced De-coupled CMS Experience 2.3.10 Minor update available for module ezcontent_api (2.3.10). Release: Collector Systems Gallery 1.0.11 Minor update available for module collector_systems (1.0.11). Release: Sector 10.3.2 Minor update available for module sector (10.3.2). Module Revived: EzContent API - Enhanced De-coupled CMS Experience 2.3.9 Module ezcontent_api updated after 15 months of inactivity (2.3.9). Security Coverage: Analyze PostHog Module analyze_posthog now has official Drupal security advisory coverage.

Simplenews SQL Sanitize

2 sites No security coverage Drupal 10–11

Part of the Simplenews ecosystem · 4 projects

View on drupal.org

This module automatically anonymizes Simplenews subscriber email addresses when you use Drush to sanitize your database. It replaces real email addresses with synthetic ones, protecting subscriber privacy when copying databases for development or staging environments. The anonymization preserves row data for testing purposes.

Simplenews SQL Sanitize teaches Drush's sql:sanitize command how to clean up Simplenews newsletter subscriber data. If your site uses Simplenews, every subscriber's real email address lives in the database — and a plain drush sql-sanitize (or drush sql:sync) copy of that database, pulled to a laptop for local development or pushed to a staging/dev site, carries all of those real addresses along with it. This module closes that gap: install it, and the next sanitize run anonymizes subscriber emails automatically, the same way Drupal core already anonymizes user accounts.

Features

  • Hooks into Drush's sql:sanitize event system (SanitizeConfirmsEvent / ConsoleTerminateEvent) — no separate command to remember, it runs as part of the sanitize operation you're already running.
  • Anonymizes each row in simplenews_subscriber (and its related subscription/tracking tables) to a synthetic address, mirroring how Drupal core rewrites users_field_data.mail to user+%[email protected].
  • Anonymizes in place rather than truncating: subscriber *rows* are preserved, so newsletter admin views, subscriber counts, and stats pages still have realistic-shaped data to develop and test against — you just can't see anyone's real email address.
  • Use this any time a production or production-adjacent database is copied somewhere less trusted: a developer's laptop, a shared staging server, a CI environment, or a client demo site.
  • If Simplenews Stats is also installed, this module additionally anonymizes the subscriber email addresses it stores for click/open tracking — detected automatically, nothing to configure. Simplenews Stats is not required; sites without it are unaffected.

Post-Installation

There's nothing to configure. Once enabled, the module registers itself with Drush's sanitize system automatically — the next time anyone runs drush sql:sanitize (or drush sql-sanitize) against a site with this module enabled, Simplenews subscriber emails are anonymized as part of that run, alongside whatever core and any other installed sanitize-aware modules already handle. No new content type, no settings page, no permissions to grant.

Additional Requirements

  • Simplenews
  • Drush, with sql:sanitize event-based sanitize architecture (Drush 10+)

Similar projects

  • Simplenews Drush Sanitize addresses the same problem but was built for Drupal 7 and Drush's old hook-based sanitize system. It has a single 7.x-1.x-dev release, hasn't seen real activity in years, and isn't compatible with the Symfony-event-based sql:sanitize used by modern Drush — it doesn't work on current Drupal/Drush versions.
  • Commerce SQL Sanitize isn't a competitor — it's the direct inspiration for this module's approach, solving the identical problem for Commerce order/address/payment data instead of Simplenews subscribers.

Supporting this Module

No funding links at this time.

Community Documentation

No configuration is required — the examples below assume Simplenews (and optionally Simplenews Stats) is already enabled.

Run a sanitize and watch for the module's own lines in the output:
drush sql-sanitize
Look for "Sanitize Simplenews subscriber email addresses." in the confirmation prompt, and "Simplenews subscriber emails sanitized." / "Simplenews mail spool truncated." in the success messages afterward.

If you want to run every other sanitize operation while skipping just this module's behavior, use these parameters:
drush sql-sanitize --sanitize-simplenews-subscribers=no --truncate-simplenews-mail-spool=no

Verify the result directly against the database:
drush sql-query "SELECT mail FROM simplenews_subscriber LIMIT 5"
Real addresses should now read like [email protected], where 42 is that row's own ID — never a real inbox.

Depends on

Dependencies of the latest stable release

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Jul 2026
Latest release
1 month ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Core Release date
1.0.0 Stable 10–11 Jul 19, 2026