Skip to content

Commit 4129965

Browse files
radabodg
authored andcommitted
SmtpMailer: workaround, STREAM_CRYPTO_METHOD_TLS_CLIENT means TLSv1_0 in PHP < 7.2, TLS_ANY as of PHP 7.2 (#58)
1 parent 5066845 commit 4129965

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Mail/SmtpMailer.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,11 @@ protected function connect(): void
149149

150150
if ($this->secure === 'tls') {
151151
$this->write('STARTTLS', 220);
152-
if (!stream_socket_enable_crypto($this->connection, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
152+
if (!stream_socket_enable_crypto(
153+
$this->connection,
154+
true,
155+
STREAM_CRYPTO_METHOD_TLS_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT
156+
)) {
153157
throw new SmtpException('Unable to connect via TLS.');
154158
}
155159
$this->write("EHLO $this->clientHost", 250);

0 commit comments

Comments
 (0)