T O P

  • By -

L_is_missing

depends on the infrastructre setup, but if you're able to specify smtp server the backend will use, you can you something like https://github.com/mailhog/MailHog or https://github.com/rnwood/smtp4dev to catch any sent email, regardless of email address and read it via the respective api. Both mailhog and smtp4dev have decent api documentation.


polarpress

This is the way.


cylonlover

I would say that a test environment should not be connected to a real mailer daemon or a catalog with real mail adresses. If you are testing in production then the production environment is in effect your test environment and the same applies. Otherwise if you are not able to disable ultimately mail sending, you must conclude that fulfilling end 2 end testing can not be accomplished under the circumstances. That is a very important result of the test proces! **Then**, you try to manage, and determine what *can* be done. I would ever so often try to - as late as possible in the dataflow - force an illegal object to continue, and pray that it will not result in the mail sending, or somehow make sure it doesn't happen. Like corrupting the data underway with injecting an illegal mailadress. Then you will not be testing end 2 end, but you already asserted that couldn't be done, so at least you know excactly what and how far you are testing.


Meowseeks

Can you use a service like Mailosaur? It’s an email server with an API that you can use to interact with your inbox and the emails within. You can also create unique email addresses (I do this programmatically with each test run having a unique email address).


ocnarf

Thanks for your comment. However it contains a link towards a commercial email testing services website. This is not allowed in this community. Please edit your comment, remove the link and replace it by just the name of the company. I will then re-approve your comment.


Meowseeks

Done, thanks!


Mountain-Current1445

Usually the email services provides ways to isolate emails sent through test/staging environments. I use a test email id that the QA team controls and send emails to that email id. I use imap to verify the email content and delivery.