MAILCATCHER - LOCAL SMTP SERVER

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
  1. Crank open your browser http://127.0.0.1:1080/ and you will get a simple interface that allows you to view messages.
  2. 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 '<jira@example.com>' (13273 bytes)
=> SMTP: Received message from '<jimb@oexample.com>' (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.

Published on Tuesday, February 25 2014     Tags: tools

COMMENT / SHARE

About

Jim is a Senior Applications Engineer working at Red Hat. He slso likes motorcycles and keeping his quadcopter out of trees.