Closed jb510 closed 5 years ago
Thanks for the suggestion @jb510
You can use define( 'POST_SMTP_RUN_MODE', 'log_only' );
in your wp-config.php
file to disallow a dev or staging environment from actually sending emails.
This is 'safer' than using the method you described, as you are likely to do a search-replace when migrating the database from production to the other environment.
Does the POST_SMTP_RUN_MODE
config value provide the feature you need?
Thank you for the tip! It sounds like it will.
I didn’t know that was built in, but with it I can certainly write my own functions to conditionally set it based on the url if needed.
Most of us have some kind of MailCatcher running on our local development boxes. Some staging environments have something similar.
All of these prevent SMTP email from being sent, but API connections to services like SendGrid often bypass those email blocks.
It would be ideal if Post SMTP had a simple setting: Only send email from this domain: domain.com
Then if/when a site was copied to domain.test or domain.local, or domain.dev.cc, or domaindev.com, domain.staging.wpengine.com or whatever... Post SMTP would know to log the email, but not to actually process it for sending though SMTP or APIs.