GD Mail Queue

Handling emails on Live vs. Staging website

A staging website (or development website) is usually a complete copy of the live website used to test new things, and in most cases, the only change between the live and staging websites is URL settings. But, if your website sends a lot of emails to website users, the staging site might do the same, and your users will end up getting emails from the staging website causing all sorts of problems.

To remedy that, you need not only create a staging website from the live website, but you need to reconfigure things to stop email sending, and that in turn may cause testing problems, because you will not be able to properly test the website before moving changes to live website again.

Safe Staging Settings in GD Mail Queue

GD Mail Queue Pro has a solution for this common problem with the Safe Staging module. This is disabled by default, but when you enable it, make sure to add Live website home page URL, and enable what type of changes you want the plugin to make if it detects that website currently runs on the staging website (domain name will be different). The plugin supports modes of staging changes: revert to PHP mail() function for email sending and stop email sending (with exceptions) and redirecting/replacing emails.

Revert to PHP mail()

In many cases, if you revert to mail() function, staging server will not really send anything, or these emails would be caught by some specialized software (for instance, Local by Flywheel development environment uses MailHog for all emails send using mail()).

Stop and Redirect emails

This method actually goes through each email and removes email addresses from it. If the email is allowed (on the send list in the settings), it will remain, all other email addresses will be removed from the email TO, CC or BCC fields.

Stop and redirect staging mode settings

Or, you can enable redirect option, and all emails that are not allowed will be replaced with a special email address target. This email address will end up receiving a lot of emails that were meant to go to real email addresses, and with that, you can debug in more detail what is happening with email delivery, or if the email is looking OK.

Spread the word about this plugin, share on social networks: