Laravel, Sending Email in local environments with Maildev

In our daily work we usually have features that require us to send emails; in such cases there are several alternatives to set up a mail server but some of them are very complex or require credentials to be shared amongs several devs.

For our Laravel projects we are currently migrating from Homestead to Laradock in order to work with Docker instead of Virtual Machines and Vagrant. Laradock includes a service called Maildev which is fake smtp server that allow us send email that are going to be trapped into it and we can see these emails with a HTTP viewer tool that comes included out of the box.

To use it we need to configure our Laravel environment to use Maildev, in your local environment, your .env file, set these line for the mail variables


NOTE : For laradock the container is called maildev, that’s why in MAIL_HOST I have set maildev as host, if you are configuring all manually set your proper host  name where maildev is running, the remaining configurations must be the same.

In laradock to start the maildev server just run

docker-compose up -d maildev

In your laradock directory.

Once the maildev container is up and running you can try to send an email from laravel and once it’s sent you can see the content in the web viewer accessing with your browser to http://localhost:1080/

That’s all, you are ready to develop email based features.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.