Connection could not be established with host "ssl://smtp.gmail.com:465"
Hello everyone, my project is running fine on live servers, but when i am sending a forgotten email, it shows an error.
Connection could not be established with host "ssl://smtp.gmail.com:465": stream_socket_client(): Unable to connect to ssl://smtp.gmail.com:465 (Network is unreachable)
please guide me on how to resolve it, at the local server it works fine, I have changed the port to 465 and encryption to SSL.
The error message suggests that the server is unable to connect to the SMTP host. This could be due to a number of reasons such as firewall restrictions, network issues, or incorrect SMTP settings.
Here are a few things you can try to resolve the issue:
Check if the SMTP host is reachable from the server. You can use the ping command to test the connectivity. For example, ping smtp.gmail.com should return a response from the server.
Check if the firewall is blocking the outgoing traffic on port 465. You may need to open the port in the firewall settings.
Verify that the SMTP settings are correct. Double-check the SMTP host, port, username, and password. Also, make sure that the encryption method is set to SSL.
Try using a different SMTP host or port. Some ISPs may block outgoing traffic on certain ports, so you may need to use a different port or SMTP host.
Here's an example of how to configure Laravel to use Gmail SMTP:
It is because you did not check your email account config you must go to c panel and email section and front of your email choose connect devices and check your out putting server you write wrong information on .env
You must add this information