Answer the question
In order to leave comments, you need to log in
Where is the error when connecting to SMTP gmail using fsockopen?
I will say right away that I do not understand web sockets at all. I'm trying to send an email via SMTP gmail. I took the code from the Internet, and received an error at the stage of establishing a connection.
$smtp_host = 'ssl://smtp.gmail.com';
$smtp_port = 465;
if (!($socket = fsockopen($smtp_host, $smtp_port, $errno, $errstr, 15)))
echo "Could not connect to smtp host ($errno) ($errstr)";
Could not connect to smtp host(0)()
If the value of the errno parameter is 0 and the function returns FALSE, then the error occurred before the connect() call. In most cases, this indicates problems with socket initialization.
Answer the question
In order to leave comments, you need to log in
the doc says that stream_socket_client() is preferable, also check if the protocol is available with the stream_get_transports() function. Check the connection to another server, perhaps this one is not responding for some reason.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question