Connection could not be established with host smtp.gmail.com :stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465
When I try to use Gmail SMTP for sending email via Laravel, I encounter the following error:
Connection could not be established with host smtp.gmail.com :stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465 (Connection timed out)
It is the trace of the error
set_error_handler(function ($type, $msg) { throw new Swift_TransportException('Connection could not be established with host '.$this->params['host'].' :'.$msg); });
you need set the email config . enter this commands into your terminal
php artisan view:clear php artisan route:clear php artisan cache:clear php artisan config:clear php artisan config:cache