Docker, MailCatcher and Laravel

Posted: 2014-11-21 14:15:02

I wrote an article on Mailcatcher and Homestead here but as I move into docker I wanted the same setup for my docker website container which was super easy.

First I downloaded this docker images and ran the command as he noted. Once done I had the website up and running.

mailcatcher_docker

From there I just started my website container and made a link.

docker run -d -p 80:80 --name website --link mailcatcher:mailcatcher -v $PWD:/share alnutile/nginxlaravel:0.3.4 /sbin/my_init

From there I was able to use the server set environments to connect to it as needed. Or more simply I just updated my local/mail.php as follows

<?php

return array(

    'driver' => 'smtp',

    'host' => getenv('MAILCATCHER_PORT_1080_TCP_ADDR'),

    'port' => 1025,

    'from' => array('address' => 'foobar@gmail.com', 'name' => 'Behat Editor Admin'),

    'encryption' => '',

    'username' => null,

    'password' => null,

    'pretend' => false,

);

Now I get to see the email as a user would see it and click around as needed!


Tags:

laravel php