Self Host and Preview Emails Locally with MailCatcher (Open Source)
MailCatcher works with any tech stack and it has a Docker image. It starts an SMTP server to view emails in a browser or any mail client.
Quick Jump: Demo Video
I’m really happy I stumbled upon https://mailcatcher.me/ when looking for a solution to preview emails in development in a secure and painless way.
I first learned about it when someone opened a PR in my example Rails Docker app with it. I kind of dismissed it because I didn’t think it was worth it, but I’ve since changed my mind.
It was super easy to get working with Flask and Rails. I’ve included it in my Build a SAAS App with Flask course as a recent update.
It hits all the marks:
- No cloud hosted service required, it’s self hosted
- It has a Docker image that works on both amd64 and arm64 CPU architectures and only uses about 30mb of memory
- It has a built in web UI to view mails but you can use any mail client if you want
- It stores emails in memory and they get purged when you stop the process
- You can preview both html and text based emails (including attachments)
- It updates in real-time when new emails arrive
- It works with any tech stack (Flask, Rails, Django, Node, etc.)
You can run it and configure your web app to send SMTP based emails to
localhost:1025 and preview those mails in its web UI that’s available at
localhost:1080. That’s it!
The video below demos using it and how to set it up:
- 0:10 – Keeping things local is great
- 0:25 – The Docker image supports amd64 and arm64 devices
- 0:47 – It works with any tech stack
- 1:03 – I just added MailCatcher to my Build a SAAS App with Flask course
- 1:26 – Demoing MailCatcher
- 2:49 – A quick list of features that MailCatcher supports
- 2:59 – Emails get sent in real-time over WebSockets
- 3:33 – It runs in memory, emails get cleared automatically when the service stops
- 3:53 – Integrating MailCatcher with a few web frameworks
- 4:19 – Configuring Flask and Flask-Mail to use it
- 6:50 – I’m really happy with MailCatcher and ultimately chose it over MailHog
- 7:43 – MailCatcher doesn’t use a lot of disk space and it only uses ~30mb of memory
Are you using MailCatcher? Let me know below.