Skip to content
Advertisement

Laravel Mail Connection could not be established Mailhog

I’ve installed Laravel Breeze and the ‘forgot password’ functionallity does not work. Login and registrer both work well, so I guess there is something wrong at sending the recovery email.

This is the displayed error:

JavaScript

at Symfony  Component  Mailer  Exception  TransportException.

and here is an screenshot: error

This is part of my .env file:

JavaScript

The environment is:

  • Ubuntu 21.10
  • Laravel 9.7.0
  • PHP 8.0.8

Tested via php artisan serve

This is a new Laravel project in which I only installed Laravel Breeze for login handling. Laravel Sail is installed.

Advertisement

Answer

you need to add this 127.0.0.1 mailhog in your hosts file and change this MAIL_HOST=0.0.0.0 in .env file or use MAIL_HOST=localhost

also you can check if your mailhog is enabled

JavaScript

To enable:

JavaScript

To start:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement