Prevent send of test emails

Hi all, I have a test system, seeded with genuine email addresses. I’d like to test some functionality that selectively sends emails to some of those accounts, and marks that an email has been sent. However, as it is real email addresses I’m wondering if there’s a way to test the functionality and somehow ‘override’ the destination email address just for the test environment. What would be the way you would approach this?
2 answers

If you are working locally, install something like Papercut SMTP that acts as a local SMTP server but ensures all your emails are sent to the application rather than real people. It allows you see what what is being sent and fully test email functionality.

Hope this helps.


For locally testing: what Robert says,

For testing this on your test-environment and other non-productive environments: create an environment-variable, set it to ‘P’ on the production-environment and another value on the other environments, in the email-microflow add a decision checking the environment-variable, if not ‘P’ replace Email/To to your testmail-adres.

Prevent accidentally setting it to ‘P’ on non-production or vice verse. Either can/will have unwanted results. So even better: download and install module ‘SystemManagement’ which already has such a environment-variable and also checks at startup, if that variable is set correctly.