Description
Resonanz Email Rerouting makes testing websites safer by rerouting outgoing emails to a specific address based on the current environment (local, development, staging, production), as defined by the WP_ENVIRONMENT_TYPE constant in your wp-config.php file.
Features
- Reroute emails based on
WP_ENVIRONMENT_TYPE. - Enable or disable email rerouting on a per-environment basis.
- Add domains to a whitelist to avoid rerouting mail sent to those domains.
- Add one or more email addresses to which emails should be rerouted.
- Grant different user roles access to the plugin settings.
- Add a prefix to the subject line of rerouted emails.
- Append a message to the body of rerouted emails.
- Display a notification to the logged-in user when an email has been rerouted.
- Enable or disable simple email logging, including a retention policy.
- Easily export and import settings in JSON format.
- Works with Gravity Forms and Contact Form 7.
Developed and maintained by Resonanz Digital, a web agency in Vienna building WordPress sites and custom web applications.
Installation
- Configure the environment variable in
wp-config.php(see FAQ below). - Upload the entire
resonanz-email-reroutingfolder to the/wp-content/plugins/directory. - Activate the plugin through the ‘Plugins’ menu in WordPress.
FAQ
How do I set the environment variable?
You can set the environment variable in your wp-config.php file. Add a line like the following:
define('WP_ENVIRONMENT_TYPE', 'local');
For further information, see the WordPress documentation: https://developer.wordpress.org/apis/wp-config-php/#wp-environment-type
Does this plugin work with other email related plugins?
We cannot guarantee that this plugin will function as expected if you use other email-related plugins.
If you have a plugin that makes use of SMTP, you should probably disable it for this plugin to work correctly.
If you encounter specific issues, please let us know.
Where can I find further help?
If you require assistance, feel free to email us at wordpress@resonanz-digital.at.
Changelog
1.8.0
- After an update, the admin pages load the new styles and scripts right away. Before, the cached file timestamps could keep the old ones for up to an hour.
- Admin screens reworked in the look of Resonanz API Sync: white cards, a page header with version and links, an “Unsaved changes” hint next to the Save button.
- Settings: the environments are WordPress tabs that open on this site’s environment and show which ones reroute. Roles are a grid of checkboxes.
- Email Logs: the table sits in a card with a count, “Rerouted?” shows as a badge, and “Purge All Email Logs” asks before it deletes anything.
- Import / Export: both forms are cards side by side.
- The settings styles and scripts now load only on the plugin’s own pages. Before, their global rules changed margins on every admin page.
1.7.0
- Security: only administrators can change settings or import them. Other roles with plugin access can view settings and logs, but not edit them. Whoever controls the reroute addresses receives password reset mails, so this access could be used to take over an administrator account.
- Security: rerouting is enforced again right before sending. Recipients that other plugins add later, such as a Bcc in phpmailer_init, are rerouted too.
- Security: rerouting now runs after other wp_mail filters, and logging runs last, so the log shows the mail as it was sent.
- Privacy: the email log no longer stores message bodies. They were never shown, but could hold password reset links and form data. Bodies stored by earlier versions are deleted on update.
- Privacy: email logs are excluded from Tools > Export.
- The admin bar and settings page warn when WP_ENVIRONMENT_TYPE is not set, also when it is set as a server variable.
- Fixed log retention comparing UTC with local time.
- Fixed senders with longer domain endings, such as .digital or .wien, missing from the log.
1.6.0
- Cc and Bcc recipients are now checked and rerouted too. When a mail is rerouted, its Cc and Bcc headers are removed.
- A mail is only delivered unchanged if every recipient is whitelisted. One address outside the whitelist reroutes the whole mail.
- Whitelisted domains are now matched exactly. “example.com” no longer matches “example.com.evil.tld”.
- The envelope sender (Return-Path) is set to the first reroute address while rerouting is active, so bounces no longer reach the client.
- The original-recipient header and the appended notice now list all original recipients, including Cc and Bcc.
1.5.1
- Fixed rerouting to multiple addresses failing with API-based mailers. Recipients are now passed as a list instead of one comma-separated string.
- Fixed the rerouting notice running onto the last line of HTML emails sent by Gravity Forms. HTML detection now ignores header case and respects the
wp_mail_content_typefilter. - The email log stores multiple recipients as a readable, comma-separated string.
1.5.0
- Hardened sanitization of saved settings: role permission keys are now validated against the roles WordPress actually offers.
- Settings import now runs through the same sanitizer as the settings form, so imported files can no longer store unsanitized values.
- Prefixed the AJAX, admin-post and log-purge action names to avoid collisions with other plugins.
- Prefixed the email log meta keys. Existing logs are migrated automatically on upgrade.
- Added nonce verification to both AJAX endpoints.
- Fixed settings import rejecting every file. The uploaded file is now identified correctly.
- Fixed settings import failing on Windows servers because the upload path was altered before use.
- Renamed an internal helper that shadowed WordPress core’s
sanitize_email(). - Updated “Tested up to” for WordPress 7.1.
1.4.0
- Hardened input handling and output escaping throughout the plugin (Plugin Check compliance).
- Fixed per-environment settings (whitelisted domains and reroute addresses) not being sanitized on save.
- Fixed role capabilities lagging one save behind when permissions were changed.
- Fixed the bundled German translation not loading (translation files renamed to match the text domain).
- Added cleanup on deactivation (scheduled event) and uninstall (options, capability, and logged data).
- Switched to safe redirects and
gmdate(), and added areadme.txt.
1.3.1
- Fixed rerouted emails crashing when
wp_mail()recipient, sender, subject, or message values were passed in non-string formats.
1.3.0
- Validation of entered email addresses in the WordPress backend.
- Performance optimizations.
1.2.5
- Fixed a minor namespace issue that was causing an error when purging logs.
1.2.4
- Make sure post slug is not empty.
- Some other minor code improvements.
1.2.3
- Added information to allow the plugin to be updated via Git Updater.
1.2.2
- First public release of the plugin.