Skip to content

Commit fab638d

Browse files
author
Marius Burkard
committed
- migrated changes from interface to server
1 parent a859549 commit fab638d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

server/lib/classes/ispcmail.inc.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public function setOption($key, $value) {
169169
$this->smtp_host = $value;
170170
break;
171171
case 'smtp_port':
172-
$this->smtp_port = $value;
172+
if(intval($value) > 0) $this->smtp_port = $value;
173173
break;
174174
case 'smtp_user':
175175
$this->smtp_user = $value;
@@ -586,8 +586,8 @@ private function _encodeSubject($input, $charset = 'ISO-8859-1') {
586586
*/
587587
private function _smtp_login() {
588588
$this->_smtp_conn = fsockopen(($this->smtp_crypt == 'ssl' ? 'tls://' : '') . $this->smtp_host, $this->smtp_port, $errno, $errstr, 30);
589-
$response = fgets($this->_smtp_conn, 515);
590589
if(empty($this->_smtp_conn)) return false;
590+
$response = fgets($this->_smtp_conn, 515);
591591

592592
//Say Hello to SMTP
593593
if($this->smtp_helo == '') $this->detectHelo();
@@ -598,13 +598,20 @@ 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+
601602
$crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT;
602603

603604
if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) {
604605
$crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
605606
$crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT;
606607
}
607-
stream_socket_enable_crypto($this->_smtp_conn, true, $crypto_method);
608+
stream_context_set_option($this->_smtp_conn, 'ssl', 'verify_host', false);
609+
stream_context_set_option($this->_smtp_conn, 'ssl', 'verify_peer', false);
610+
stream_context_set_option($this->_smtp_conn, 'ssl', 'verify_peer_name', false);
611+
stream_context_set_option($this->_smtp_conn, 'ssl', 'allow_self_signed', true);
612+
if (stream_socket_enable_crypto($this->_smtp_conn, true, $crypto_method) != true) {
613+
return false;
614+
}
608615
}
609616

610617
//AUTH LOGIN

0 commit comments

Comments
 (0)