From aff9c7748b7ebaceadfd253edc85aa0e9ebed031 Mon Sep 17 00:00:00 2001 From: Eric Espie Date: Tue, 29 Nov 2022 08:55:29 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B05155=20-=20Email=20by=20SMTP=20with=20se?= =?UTF-8?q?lf-signed=20certificate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/config.class.inc.php | 16 ++++++++++++++++ sources/Core/Email/EmailSwiftMailer.php | 3 +++ 2 files changed, 19 insertions(+) diff --git a/core/config.class.inc.php b/core/config.class.inc.php index 45efc63c6..0506e8ec8 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -555,6 +555,22 @@ class Config 'source_of_value' => '', 'show_in_conf_sample' => false, ), + 'email_transport_smtp.allow_self_signed' => array( + 'type' => 'bool', + 'description' => 'Allow self signed peer certificates', + 'default' => false, + 'value' => false, + 'source_of_value' => '', + 'show_in_conf_sample' => false, + ), + 'email_transport_smtp.verify_peer' => array( + 'type' => 'bool', + 'description' => 'Verify peer certificate', + 'default' => false, + 'value' => false, + 'source_of_value' => '', + 'show_in_conf_sample' => false, + ), 'email_css' => array( 'type' => 'string', 'description' => 'CSS that will override the standard stylesheet used for the notifications', diff --git a/sources/Core/Email/EmailSwiftMailer.php b/sources/Core/Email/EmailSwiftMailer.php index 01d8b5d24..03b2d4801 100644 --- a/sources/Core/Email/EmailSwiftMailer.php +++ b/sources/Core/Email/EmailSwiftMailer.php @@ -159,11 +159,14 @@ class EmailSwiftMailer extends EMail $sEncryption = static::$m_oConfig->Get('email_transport_smtp.encryption'); $sUserName = static::$m_oConfig->Get('email_transport_smtp.username'); $sPassword = static::$m_oConfig->Get('email_transport_smtp.password'); + $bAllowSelfSigned = static::$m_oConfig->Get('email_transport_smtp.allow_self_signed'); + $bVerifyPeer = static::$m_oConfig->Get('email_transport_smtp.verify_peer'); $oTransport = new Swift_SmtpTransport($sHost, $sPort, $sEncryption); if (strlen($sUserName) > 0) { $oTransport->setUsername($sUserName); $oTransport->setPassword($sPassword); + $oTransport->setStreamOptions(array('ssl' => array('allow_self_signed' => $bAllowSelfSigned, 'verify_peer' => $bVerifyPeer))); } break;