Installing MailCatcher in Laravel Homestead

Posted by Adam Engebretson on July 1, 2014

MailCatcher runs a super simple SMTP server which catches any message sent to it to display in a web interface. Run mailcatcher, set your favourite app to deliver to smtp:// instead of your default SMTP server, then check out to see the mail that's arrived so far.

I found MailCatcher to be incredibly useful while testing emails in my Laravel 4 applications. While setting Mail::pretend() can be useful, it only gives you limited information about the message your application attempted to send.

Jeffrey Way has a great lesson on testing your emails with MailCatcher at Laracasts in which he discusses the installation of MailCatcher. However, Laravel Homestead is not prepared to handle the quick and easy installation outlined in Way's video.

After some research, I was able to successfully get MailCatcher running in my Laravel Homestead machine. Here's how!

// Install MailCatcher
$ sudo apt-get install ruby1.9.1-dev libsqlite3-dev
$ sudo gem install mailcatcher

Next, you'll need to run MailCatcher. My Homestead IP is, so I'll be using that one. Most Laravel Homestead installs will use, but this is customizable in Homestead.yaml.

// Run Mailcatcher
$ mailcatcher --ip

You can now access MailCatcher in your browser at

To use MailCatcher in your Laravel application, you'll have to edit the configuration in /app/config/mail.php. However, it's recommended to copy this file to /app/config/local/mail.php so that the configuration only applies to your local development environment. Here's my mail.php config file.


return [

  'driver'     => 'smtp',

  'host'       => '',

  'port'       => 1025,

  'from'       => array('address' => '', 'name' => 'Test Email Sender'),

  'encryption' => false,

  'username'   => null,

  'password'   => null,


It's important that you set the port to 1025, and you disable encryption.

Go ahead and send an email from Laravel, and see it appear in the MailCatcher UI!