Search code examples
phplaravelmailhog

How do I run Laravel Mailhog using PHP server


I'm not able to install Homestead, so I'm using the command line below to run my Laravel app

php -S localhost:8000 -t public/

I'm trying to get Mailhog running. On my .env file, I set the mail driver as follows

MAIL_DRIVER=smtp
MAIL_HOST=localhost
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

If I go to http://localhost:8025/, I get "This site can't be reached"


Solution

  • The only reason that I know of that you would receive that error is if you haven't started mailhog. So, if that is the case, you need to open a terminal and type mailhog and then hit enter. That will start mailhog. Then you should be able to go to http://127.0.0.1:8025/ and mailhog will be available.