Home > front end >  Connection could not be established with host mailhog :stream_socket_client(): unable to connect to
Connection could not be established with host mailhog :stream_socket_client(): unable to connect to

Time:09-29

I'm getting an error in mailhog while sending an email.

Error:

Connection could not be established with host mailhog :stream_socket_client(): unable to connect to null://mailhog:1025 (Unable to find the socket transport "null" - did you forget to enable it when you configured PHP?)

my code :

Mail::to('[email protected]')->send(new MessageMail($message));

and .env config:

MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=null
[email protected]
MAIL_FROM_NAME="${APP_NAME}"

I use docker and my laravel version is 8, PHP Version 7.4.10 as well I am migrating from symfony to laravel.

CodePudding user response:

As stated by Ken Lee in the comments:

You're using an invalid value (null) for MAIL_ENCRYPTION.

MAIL_ENCRYPTION=null

Use an empty value instead for MAIL_ENCRYPTION:

MAIL_ENCRYPTION=
  • Related