Skip to content

Conversation

@radabo
Copy link
Contributor

@radabo radabo commented Feb 18, 2019

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?

@dg
Copy link
Member

dg commented Feb 18, 2019

Looks good. Did you test it?

@radabo
Copy link
Contributor Author

radabo commented Feb 18, 2019

I tried:

PHP version 7.1
TLS 1.2 - OK
TLS 1.1 - OK
TLS 1.0 - OK

@dg dg merged commit 3669474 into nette:master Feb 18, 2019
@dg
Copy link
Member

dg commented Feb 18, 2019

Thanks

dg pushed a commit that referenced this pull request Feb 18, 2019
dg pushed a commit that referenced this pull request Feb 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants