Press "Enter" to skip to content

How to get email working with Vagrant and MailCatcher

Recently I needed to send emails locally. My local dev environment uses Vagrant, so I researched some options and tried installing MailCatcher. I was able to successfully install MailCatcher and run it locally, however I couldn’t access it from my host machine. If I used curl on my virtual machine I could see the HTML for MailCatcher, but trying to visit the same URL from my host machine would result in a never ending page load.

The Solution

Luckily, if you configure your Vagrant using PuPHPet the process for setting up MailCatcher becomes infinitely easier! Follow the steps outlined below and enjoy testing emails in your local dev environment:

  1. Configure box through PuPHPet
    • Choose MailCatcher when you get to ‘Additional Tools’
  2. Set your site to use SMTP (if using a CMS download an SMTP plugin)
    • SMTP Address is 127.0.0.1
    • Port is 1025
  3. Send a test email
  4. Visit http://[VAGRANT_IP]:1080 to view the email

I hope this helps save someone a few hours of debugging!

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *