Okay picture this: You’re building your awesome web app and suddenly, you have to verify that emails are being sent properly. You’d want some kind of app that would drop emails in a folder, right?
If you were on Windows, that would be fairly easy. Just hit a web search and install one of the many dummy SMTP servers out there.
But you’re probably on Linux (why else would you be reading this). And on Linux, there is no such app. You’ll have to hack your way out of this.
Well not anymore. Thanks to this awesome script by Stuart Colville, I was able to create a dummy SMTP server in Python. I’ve posted the code on github :
It’s really simple to use :
- Download the .zip
- Extract it
- Make “listen.py” executable
- Kill any process using port 25 (usually “sudo pkill sendmail” is enough)
- Type “sudo ./listen.py” on your console
- Tada! All emails sent will be dropped in the “mails” folder.
I’ve only tested this with Sendmail. So if you see something weird with other MTAs, let me know!