Here are two approaches to testing code that sends email, that I have stumbled over recently:
- Ethereal "is a fake SMTP service, mostly aimed at Nodemailer users (but not limited to). It's a completely free anti-transactional email service where messages never get delivered."
- Test mail server on Ubuntu and Debian.
The difference in approach is thought provoking.
Why would you spend the time to implement something that simulates a real mail server, when you can just install a real mail server, and use it to test against?
Why would you test against a simulation (which might have its own set of quirks and shortcomings), rather than the real thing?
Kind of mind boggling to me. But that's apparently what's en vogue.