Q&A
How do you test email flows in automated tests without a real email inbox?
Ajitesh MohantaAmbassador
May 15, 2026 1,465 0
We have several user flows triggered by emails: registration confirmation, password reset, order confirmation. I need to test the full flow including clicking the link in the email.
Options I've explored:
1. **Mailhog** — fake SMTP server with a web UI and API. Works but adds infrastructure to CI.
2. **Mailosaur** — real email inboxes via API, designed for testing. ~$20/month.
3. **Intercept the email sending at the service level** — mock the email service and extract the token/link from the mock call. Fast but doesn't test the actual email template.
4. **Check the DB for the generated token directly** — bypasses the email entirely.
What do you use and what are the tradeoffs you've lived with?