Closed radabo closed 5 years ago
Version: 2.4
If SMTP server support only TLS 1.2 isn't possible connect it.
In SmtpMailer is now this: stream_socket_enable_crypto($this->connection, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)
stream_socket_enable_crypto($this->connection, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)
i found solution on php.net
$cryptoMethod = STREAM_CRYPTO_METHOD_TLS_CLIENT;
if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) { $cryptoMethod |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; $cryptoMethod |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT; }
if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) {
$cryptoMethod |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
$cryptoMethod |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT;
}
if (!stream_socket_enable_crypto($this->connection, true, $cryptoMethod)) { throw new SmtpException('Unable to connect via TLS.'); }
if (!stream_socket_enable_crypto($this->connection, true, $cryptoMethod)) {
throw new SmtpException('Unable to connect via TLS.');
What do you think?
In PHP 5.6 there should be STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT & STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT, so test via defined() is not imho needed. Can you send PR?
Version: 2.4
Bug Description
If SMTP server support only TLS 1.2 isn't possible connect it.
Expected Behavior
In SmtpMailer is now this:
stream_socket_enable_crypto($this->connection, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)
i found solution on php.net
$cryptoMethod = STREAM_CRYPTO_METHOD_TLS_CLIENT;
if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) {
$cryptoMethod |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
$cryptoMethod |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT;
}
if (!stream_socket_enable_crypto($this->connection, true, $cryptoMethod)) {
throw new SmtpException('Unable to connect via TLS.');
}
What do you think?