Setup MailHog with Laravel valet localhost or Laravel Sail

Installing MailHog

Panjeh
2 min readMar 15, 2021
brew install mailhog

Enabling:

Enable the service via running the command below:

brew services start mailhog# also you can stop it whenever you want using:brew services stop mailhog

This tells Homebrew to setup a background service. Then MailHog is always running on your machine. As long as Homebrew is running, you won’t need to manually start anything, .

Now, you can visit MailHog application under the following in a browser:

http://127.0.0.1:8025/

Before continue reading the reset of this tutorial, I would like to introduce Laravel Pay Pocket which I have developed it recently.

https://github.com/HPWebdeveloper/laravel-pay-pocket

For localhost you need to set two variable in Laravel .env file.

Attention I:

If you are using Laravel Sail you should set

MAIL_HOST=mailhog

Otherwise it must be

MAIL_HOST=localhost

Attention II:

The SMTP server is running on port 1025, where the HTTP server (which serves MailHog UI) is running on 8025.

I would like to introduce two packages for Laravel that I have recently developed: Laravel Pay Pocket, a modern multi-wallet package, and Laravel Failed Jobs, a UI for the Laravel Failed Jobs Table. I hope they may be of help to you.

https://github.com/HPWebdeveloper/laravel-pay-pocket
https://github.com/HPWebdeveloper/laravel-failed-jobs

--

--