While working on MembershipNerd I was looking for a very simple service that would let me write automated, end-to-end tests for sending emails. In particular, I wanted to create an automated test for the sign-up process. By “end-to-end test” I mean that I actually want to send an email, with a real SMTP server, verify that the email has been received by the recipient and contains the correct information.
If I simply wanted to verify that the sign-up triggers an email, then I could use the built-in email service of Django’s testing framework.. If your web framework doesn’t such a convenient way to test email, you might want to have a look at MailHog. Be aware it needs more setup though!
Since I want to make sure that not only does the business logic work correctly, but also verify the correct configuration of all involved services, neither Django’s testing framework nor MailHog will help me.
Basically, I want this to be part of a smoke-test when deploying to production.
Luckily, there are a couple of services that provide this functionality.
The one I settled on for now is testmail.app, because I had an extremely quick onboarding experience that was exactly matching my use case: After logging in, they suggested sending a test-mail to my randomly generated inbox. Next, I was asked to click a link in the browser, which opened a new window and showed the JSON-response I was looking for. The output looked something like this:
Awesome! Exactly what I was looking for. All of this took probably less than a minute.