MailCatcher - Local SMTP ServerTuesday, February 25 2014
Recently I've been developing a lot of JIRA workflows and I wanted to be able to test the email delivery as well but didn't want to reconfigure our existing notifications to send to different people.
I considered setting up my own mail server but that seemed a bit heavy for what I needed. I just needed to verify the mail was sent...
Turns out MailCatcher does exactly this.
MailCatcher runs a super simple SMTP server which catches any message sent to it to display in a web interface.
MailCatcher requires Ruby but installation is a simple:
gem install mailcatcher
Then crank open your console and fire off 'mailcatcher' and it will return some info on what ports it is listening on:
C:\Users\jpriest\scripts\batch> mailcatcher Starting MailCatcher => smtp://127.0.0.1:1025 => http://127.0.0.1:1080
- Crank open your browser http://127.0.0.1:1080/ and you will get a simple interface that allows you to view messages.
- Update your application with the SMTP information provided and you should be set!
Now when you send an email you should see it logged in the console as well as appear in the browser:
C:\Users\jpriest\scripts\batch> mailcatcher Starting MailCatcher => smtp://127.0.0.1:1025 => http://127.0.0.1:1080 => SMTP: Received message from '<email@example.com>' (13273 bytes) => SMTP: Received message from '<firstname.lastname@example.org>' (12982 bytes)
I also setup my local Railo mail to run through MailCatcher as well. I setup MailCatcher to be the first server and my 'real' mail server as the second. Then during development if I want to catch email locally I can crank up MailCatcher, and if it's not running Railo will fall back on the main mail server.