Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

Added options to disable ssl verify_peer_name to avoid issues on some shared hosting installations

givanzd622cb4f8e21
diff --git a/system/mail/mail.php b/system/mail/mail.php
index 470fdda..f748be6 100755
--- a/system/mail/mail.php
+++ b/system/mail/mail.php
@@ -129,6 +129,6 @@ class Mail {
ini_set('sendmail_from', $this->option['from']);
$subject = '=?UTF-8?B?' . base64_encode($this->option['subject']) . '?=';
- mail($to, $subject, $message, $header, $this->option['parameter'] ?? '');
+ \mail($to, $subject, $message, $header, $this->option['parameter'] ?? '');
}
}
diff --git a/system/mail/smtp.php b/system/mail/smtp.php
index ee94ee2..49029ab 100755
--- a/system/mail/smtp.php
+++ b/system/mail/smtp.php
@@ -27,6 +27,17 @@
namespace Vvveb\System\Mail;
class Smtp {
+ protected $socketOptions = [
+ 'ssl' => [
+ 'allow_self_signed' => true,
+ 'verify_peer' => false,
+ 'verify_peer_name' => false,
+ //'ciphers' => 'TLSv1.3|TLSv1.2|TLSv1|SSLv3',
+ //'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT,
+ //'crypto_type' => STREAM_CRYPTO_METHOD_TLS_CLIENT,
+ ],
+ ];
+
protected $option = [
'port' => 25,
'timeout' => 5,
@@ -132,7 +143,14 @@ class Smtp {
$hostname = $this->option['host'];
}
- $handle = fsockopen($hostname, $this->option['port'], $errno, $errstr, $this->option['timeout']);
+ //$handle = fsockopen($hostname, $this->option['port'], $errno, $errstr, $this->option['timeout']);
+ $context = stream_context_create();
+
+ if ($this->socketOptions) {
+ stream_context_set_options($context, $this->socketOptions);
+ }
+
+ $handle = stream_socket_client("tcp://$hostname:{$this->option['port']}", $errno, $errstr, $this->option['timeout'], STREAM_CLIENT_CONNECT, $context);
if ($handle) {
if (substr(PHP_OS, 0, 3) != 'WIN') {