We’ve all had to deal with them in a project once, emails. This doesn’t have to be directly developing on emails, think developing on something that triggers an email. Now if there’s one thing I hate while development, it’s having to wait on something. And that’s what emails make me do. Wait.
If you’re lucky there’s a few seconds wait per email. If you’re unlucky for too many reasons that I want to get into in the post it can take up to minutes. And if you’re a Gmail user like me there’s the grouping of emails with the same sender and subject. Normally a nice feature but while testing emails a drama. It automatically ignores the part of the email that’s the same as previous in the serie, resulting in funky looking emails.
If you’re developing on something Unix based, for example virtually with Vagrant like I do, you can install an amazing application called MailCatcher.
MailCatcher runs a super simple SMTP server which catches any message sent to it to display in a web interface.
What MailCatcher does is setting up a SMTP server and storing sent emails instead of actually sending them. The result? Instant email ‘delivery’ accessible on the development machine you’re working on! MailCatcher has a lot of cool features that are all documented on their website but I’ll just share my setup here. I’ve added the following MailCatcher related stuff to my Vagrant’s box provision file.
Above snippet is part of a bigger provision file but if you’ve setup a provision file before you’ll know where to paste each part.
If I now go to
http://192.168.33.10:1080/ in my browser I’ll have a web interface that displays emails sent from my vagrant box without any lag.
I just love this application, it has saved me so much frustration and time. Give it a try, it’s easy to setup and the next time you’re working with emails you’ll happy you did. As always I’d love to hear your thoughts in the comments below. Go MailCatcher.