Drupal is a registered trademark of Dries Buytaert
Menu Per Role 8.x-1.9 Minor update available for module menu_per_role (8.x-1.9). AI (Artificial Intelligence) 1.5.0-alpha1 First alpha version released for module ai (1.5.0-alpha1). Easy Encryption 1.0.4 Minor update available for module easy_encryption (1.0.4). Soccerbet 1.1.15 Minor update available for module soccerbet (1.1.15). United Nations Maps & Geoservices 3.0.8 Minor update available for module unep_maps (3.0.8). Burndown 1.0.71 Minor update available for module burndown (1.0.71). Bible 3.4.1 Minor update available for module bible (3.4.1). Bible 3.4.0 Minor update available for module bible (3.4.0). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs. Cha-ching donation register 1.0.18 Module chaching updated after 6 months of inactivity (1.0.18).

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.

Activity

Total releases
1
First release
Jul 2026
Latest release
20 hours ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Release date
1.0.0 Stable Jul 19, 2026