Installing Mailcatcher for use in Laravel Projects

Using Laravel Homestead is an excellent way to quickly create and maintain Laravel projects. At some point you will want to test out your emails, this could be a registration email or a newsletter. Either way you will want somewhere locally to receive and test each time.
MailCatcher is run on your local browser using the address, http://localhost:1080.

Let’s Begin

Make sure Vagrant is down by running
vagrant halt

We need to set up our homestead.rb file with some port forwarding rules. You can find this in homestead/scripts/homestead.rb. Add the following line to this file in the default_ports
1080 => 1080
.Once this is saved run:
vagrant up
. You will notice in the processes and forwarded port defaultL 1080=>1080(adapter 1).
Now SSH into Vagrant using in your homestead folder:
vagrant ssh
sudo apt-get update
sudo apt-get install ruby1.9.1-dev
sudo gem install mailcatcher

To ensure this runs on vagrant up everytime create a new file called:
sudo nano /etc/init/mailcatcher.conf
#In this file save this
description "Mailcatcher"
start on runlevel [2345]
stop on runlevel [!2345]
exec /usr/bin/env $(which mailcatcher) --foreground --http-ip=

Now exit the Vagrant Box and run:
vagrant reload

In your Laravel Project you need to go into you .env file and set this:

You should now recieve emails on http://localhost:1080