Just realized that our staging environment is sending out emails to customers, which is not good.

How can I limit the emails to developers only? Ideally I would like to:

  • provide a list of allowed emails
  • provide a default email to which all emails not in "allowed" list would be routed to

Already did a google search and didn't come up with anything useful.

  • I think database cleanup would help you out if that is okay to you.. Remove all the live customers data from staging environment. Dec 1, 2018 at 15:23
  • That is an idea, but since we do regularly re-create staging from live, would prefer an extension which I can config it based on our needs. Dec 2, 2018 at 12:09

1 Answer 1


We can't limit the emails like you asked. But we can disable the Email functionality itself in the Staging or DEV environment by following the below steps.

Step 1: Go to Stores -> Settings -> Configuration -> System -> Advanced.

Step 2: Set Mail Sending Settings to Yes to disable the Email functionality.

Reference link: https://docs.magento.com/user-guide/system/email-communications.html

Mailtrap is also an option. So the actual users will not receive the mails But we can review them.

  • Thank you for the tip. I no longer work with Magento, but I am sure someone else will find your answer useful. But do note that back in the day, I reverted into cleaning the database for staging and then adding fake users. Today, I would look into sending emails to Mailtrap or related service. I am sure that someone already coded extension for this. Sep 15, 2021 at 19:12
  • Sure @KristjanO. I had also included the MailTrap in my answer. Thanks !! Sep 16, 2021 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.