diff --git a/smtp.php b/smtp.php index a7d99e55..caaebd56 100644 --- a/smtp.php +++ b/smtp.php @@ -209,9 +209,14 @@ function send($message,$log=TRUE,$mock=FALSE) { $reply=$this->dialog('EHLO '.$fw->HOST,$log,$mock); if (strtolower($this->scheme)=='tls') { $this->dialog('STARTTLS',$log,$mock); - if (!$mock) - stream_socket_enable_crypto( - $socket,TRUE,STREAM_CRYPTO_METHOD_TLS_CLIENT); + if (!$mock) { + $method=STREAM_CRYPTO_METHOD_TLS_CLIENT; + if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) { + $method|=STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; + $method|=STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT; + } + stream_socket_enable_crypto($socket,TRUE,$method); + } $reply=$this->dialog('EHLO '.$fw->HOST,$log,$mock); } $message=wordwrap($message,998);