Skip to content

Commit 3d4127a

Browse files
author
Marius Burkard
committed
- fix problem with tls version on STARTTLS in mail class
1 parent b7ee5f0 commit 3d4127a

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

interface/lib/classes/ispcmail.inc.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,10 +599,16 @@ private function _smtp_login() {
599599
fputs($this->_smtp_conn, 'STARTTLS' . $this->_crlf);
600600
fgets($this->_smtp_conn, 515);
601601

602+
$crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT;
603+
604+
if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) {
605+
$crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
606+
$crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT;
607+
}
602608
stream_context_set_option($this->_smtp_conn, 'ssl', 'verify_host', false);
603609
stream_context_set_option($this->_smtp_conn, 'ssl', 'verify_peer', false);
604610
stream_context_set_option($this->_smtp_conn, 'ssl', 'allow_self_signed', true);
605-
stream_socket_enable_crypto($this->_smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
611+
stream_socket_enable_crypto($this->_smtp_conn, true, $crypto_method);
606612
}
607613

608614
//AUTH LOGIN

server/lib/classes/ispcmail.inc.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,13 @@ private function _smtp_login() {
598598
if($this->smtp_crypt == 'tls') {
599599
fputs($this->_smtp_conn, 'STARTTLS' . $this->_crlf);
600600
fgets($this->_smtp_conn, 515);
601-
stream_socket_enable_crypto($this->_smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
601+
$crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT;
602+
603+
if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) {
604+
$crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
605+
$crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT;
606+
}
607+
stream_socket_enable_crypto($this->_smtp_conn, true, $crypto_method);
602608
}
603609

604610
//AUTH LOGIN

0 commit comments

Comments
 (0)