N°5155 - Email by SMTP with self-signed certificate

This commit is contained in:
Eric Espie
2022-11-29 08:55:29 +01:00
parent e518d34bc9
commit aff9c7748b
2 changed files with 19 additions and 0 deletions

View File

@@ -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',

View File

@@ -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;