When you’re developing a WordPress site locally or testing in staging, you’ll generally want to prevent the site from sending out emails to customers or users.
I’ve noticed that a number of other WordPress developers are fans of MailHog (great write up by Jonathan Christopher), but in many cases it’s easier if you don’t have to install anything additional on the server.
I use two plugins to block and then log emails:
“Disable Emails” prevents the emails from sending from WordPress, and “Email Log” is able to capture their contents in case you need to view them.
Since I sync my production environment to staging and local quite frequently, I have a script in my theme that activates these plugins when it detects the new environment.
Good solution. There should be reminder task to remove these plugins once local copy is upload to production server.
If forgotten users will not get any emails and that might be bad for the client.
I think it’s fine to have these on a production server, as long as they aren’t activated. I sync staging to production frequently, so it’s easier if the plugin files don’t need to be installed. The script I mentioned will activate the plugins in the right environments, but if you’re paranoid about them accidentally getting activated in production, you can write some additional code to hide them from the admin or autodisable if they ever get turned on.