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).

Mail Redirect

57 sites Security covered Drupal 9–11 Mail ecosystem
View on drupal.org

The Mail Redirect module redirects all system-generated emails to a specified test domain or email address. This is useful for testing purposes when using a production database with real email addresses. It supports redirecting CC and BCC recipients as well.

The Mail Redirect module redirects ALL system generated email (see notes below that CC/BCC were not supported until the 3.x branches of D7/D8/D9) to a test mail domain or address. This is especially useful when doing site testing which uses a production database which is populated with real email addresses.

Works with any mail generated by drupal_mail().

Latest Notes:

I have noticed that past use of setting CC/BCC in $message['params']['headers'] MAY no longer work. I haven't be able to find details on this core API change but possibly this is from D9.5+. I am releasing version 4.2.0 as compatible with D9.5/D10 which now sets CC/BCC directly in $message['headers']. Good idea to test that this is properly redirecting your CC/BCC addresses.

General Usage:

Drupal 7

usage:
- in your test site's settings.php set:

$conf = array('mail_redirect_opt' => "domain");
$conf = array('mail_redirect_domain' => "mydomain.com");

OR

$conf = array('mail_redirect_opt' => "address");
$conf = array('mail_redirect_address' => "[email protected]");

Drupal 8/9

usage:
- in your test site's settings.php set:

$config['mail_redirect.settings']['mail_redirect_opt'] = 'domain';
$config['mail_redirect.settings']['mail_redirect_domain'] = 'mydomain.com';

OR

$config['mail_redirect.settings']['mail_redirect_opt'] = 'address';
$config['mail_redirect.settings']['mail_redirect_domain'] = '[email protected]'

result:
- input $to: [email protected]
- output $to:
[email protected]
OR
[email protected]

This module was developed for a multi-developer test environment where ongoing development work runs in parallel with the operation of the production site. The developers regularly sync their test site's db to that of the production server. Our general development environment provides numerous sites folders for a mutli-site setup so that each developer has their own local and server based sandboxes for testing and development. As an example:

3 developers: tom, joe, hank

site folders as:
- www.oursite.com (production site)
- oursite.joe (joe's local)
- oursite.tom
- oursite.hank
- joe.oursite.com (joe's server sandbox)
- hank.oursite.com
- tom.oursite.com

Set up subdomains on a shared host account (we use Dreamhost.com) which provides unlimited subdomains and catch-all email accounts.

e.g. mail domains:
- joe.somedomain.com
- hank.somedomain.com

Set each of these up with catch-all mail accounts.

For Joe's local development system (oursite.joe):
- in sites/oursite.joe/settings.php
- defined $conf['mail_redirect_domain'] = 'joe.somedomain.com';

Now, when mail_redirect module is enabled all the site email will redirect to that domain. E.g.:

[email protected] -> [email protected]

All mail will be sent to one catch-all account and it is possible to see what email the system has sent out and who they have been sent to.

This project was designed by LiquidCMS and funded by LifeWire, a NY Times Company.

Drupal 7

Added features in D7 version:
- allow list of addresses to ignore when doing redirect
- silent redirect to simply not send the redirected emails

Drupal 7.x-3.x

Added features in D7 Rel 3.x version:
- support redirecting to a single email address
- add support for CC/BCC
- NOTE: Prior to 3.x branch CC/BCC was not supported.

Drupal 8.x-3.x

- NOTE: Prior to 3.x branch CC/BCC was not supported.

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
2
Tracked since
Nov 2025
Latest release
1 month ago
Releases (12 mo)
2 ▲ from 0
Maintenance
Active

Releases

Version Type Core Release date
4.2.6 Stable 9–11 Jul 24, 2026
4.2.5 Stable 9–11 Nov 14, 2025