blog
Fake SMTP Server Setup for Testing (Local + CI Pattern)
Set up a fake SMTP server for testing, validate send flows safely, and move from local-only checks to production-grade CI email validation.
A fake SMTP server accepts test mail but does not deliver to real recipients.
Use it to safely validate email generation and app integration during development.
For the fuller fake SMTP testing workflow with inbox assertions, headers, webhooks, and CI examples, start with the fake SMTP server guide.
Quick setup model
- run fake SMTP locally (for example smtp4dev)
- point app SMTP host/port to local endpoint
- trigger app emails
- inspect captured messages
Example local setup with smtp4dev
docker run --rm -it -p 3000:80 -p 2525:25 rnwood/smtp4dev:v3
Then configure your app:
- SMTP host:
localhost - SMTP port:
2525
What to validate in fake SMTP tests
- subject/body correctness
- dynamic token/link injection
- sender and recipient addressing
- attachment and MIME structure
- duplicate-send prevention behavior
Why not test with personal Gmail inboxes?
Using real personal inboxes for dev loops can:
- add noise and false confidence
- hide deterministic failures
- create accidental send risks
A fake SMTP endpoint gives faster and safer local feedback.
Local fake SMTP limitations
- no real mailbox-provider filtering behavior
- limited deliverability signal
- weak cross-team visibility without extra tooling
Local to CI to production workflow
| Stage | Goal | Recommended tools |
|---|---|---|
| Local dev | Fast iteration | fake SMTP (smtp4dev, MailHog, MailCatcher) |
| CI | Deterministic end-to-end assertions | Email integration testing |
| Staging/prod checks | Delivery and policy validation | Email Sandbox + deliverability test |
Release checklist
- Validate local fake SMTP flow for all transactional templates.
- Add receive-side assertions in CI pipelines.
- Validate webhooks for delivery/bounce/reject events.
- Confirm SPF, DKIM, and DMARC alignment.
- Run pre-release deliverability checks.
Helpful routes:
FAQ
Is a fake SMTP server enough for production confidence?
No. It is necessary for local safety but insufficient for final release quality.
Which fake SMTP tool should I choose?
Choose the one that best fits your team workflow; consistency matters more than tool brand.
Can I run fake SMTP in CI?
Yes, but pair it with programmable receive-side assertions and event checks.