MailCatcher is a great Ruby gem that provides you with a simple SMTP server and web interface to preview the output of HTML emails sent. I’ve been using it recently for testing our Laravel mailers.
Install it in the usual way:
$ [sudo] gem install mailcatcher
Just a quick note for you Ubuntu users, you’ll need to ensure you have the libsqlite3 headers installed;
$ [sudo] apt-get install libsqlite3-dev
Start it up:
$ mailcatcher Starting MailCatcher ==> smtp://127.0.0.1:1025 ==> http://127.0.0.1:1080 *** MailCatcher runs as a daemon by default. Go to the web interface to quit.
Then configure Laravel to use smtp for emails, I do this in app/config/local/mail.php:
<?php return [ 'driver' => 'smtp', 'host' => '127.0.0.1', 'port' => 1025, 'encryption' => '' ];
Note you should definitely do this in your local configuration as you need to disable encryption for this to work as MailCatcher does not support TLS.