Using mailcatcher with Homestead
I was recently made aware of mailcatcher, an awesome little tool to allow devs to run a mock SMTP server on their machine and direct their apps mail to it when developing / testing.
At VentureCraft we’re using Homestead to organize and keep dev environments in sync which is awesome, but caused some problems when we wanted to set mail settings in a mail.php config file when running in Homestead, since if I had mailcatcher running on my local machine I needed to point the mail config there, which would obviously cause issues for other developers working offset.
Here’s what we came up with.
First, I adding the following to my serve.sh file:
sudo apt-get install ruby1.9.1-dev -y sudo apt-get install libsqlite3-dev sudo gem install mailcatcher
Then I have to SSH in and run “mailcatcher –ip=192.168.33.10″
If I try add that line to the serve.sh file, it complains that port 1025 is already in use for some reason.
(192.168.33.10 being the IP set in homestead.rb)
This does increase the boot up time quite a bit, which is annoying, but it works.
I can now hit http://192.168.33.10:1080/ to view the mail, and send to 192.168.33.10 on port 1025 in my mail.php config file.
It would be awesome if mailcatcher was built into @laravelphp‘s Homestead for dev / testing purposes
— Chris Duell (@duellsy) June 23, 2014