some improvements for the smtp class regarding TLS protocoll

This commit is contained in:
Klaus Leithoff 2008-06-20 10:51:59 +00:00
parent 88f99c5eb6
commit ecd3948175

View File

@ -191,11 +191,14 @@ class SMTP {
} }
//Begin encrypted connection //Begin encrypted connection
if(!stream_socket_enable_crypto($this->smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) { $retval = stream_socket_enable_crypto($this->smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
return false; // if there are not enough data enable crypto may return 0, then we switch to blocking mode for the stream temporarily
} if ($retval === 0) {
stream_set_blocking($this->smtp_conn, true);
return true; $retval = stream_socket_enable_crypto($this_smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
stream_set_blocking ($this->smtp_conn, false);
}
return $retval;
} }
/** /**
@ -763,7 +766,7 @@ class SMTP {
} }
// send the quit command to the server // send the quit command to the server
fputs($this->smtp_conn,"quit" . $this->CRLF); fputs($this->smtp_conn,"QUIT" . $this->CRLF);
// get any good-bye messages // get any good-bye messages
$byemsg = $this->get_lines(); $byemsg = $this->get_lines();