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.
2
Answers
As stated by Ken Lee in the comments:
You’re using an invalid value (
null
) forMAIL_ENCRYPTION
.Use an empty value instead for
MAIL_ENCRYPTION
:Close The Serve than Run:
and still you facing this issue close the project and Run it again.
I hope it’s Work and you don’t need to do any changing in .env