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.
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:
- Configure box through PuPHPet
- Choose MailCatcher when you get to ‘Additional Tools’
- Set your site to use SMTP (if using a CMS download an SMTP plugin)
- SMTP Address is 127.0.0.1
- Port is 1025
- Send a test email
- Visit http://[VAGRANT_IP]:1080 to view the email
I hope this helps save someone a few hours of debugging!