Skip to content

Commit

Permalink
Add allow self singed in mail setting (#20046)
Browse files Browse the repository at this point in the history
* add allow self singed

add allow self singed

* update change log

update change log

* update config options

update config options

* update changelog version number

update changelog version number

* resolve conflic

resolve conflic

* Update config/global.ini.php

Co-authored-by: Stefan Giehl <stefan@matomo.org>

* Update config/global.ini.php

Co-authored-by: Stefan Giehl <stefan@matomo.org>

* Update config/global.ini.php

Co-authored-by: Stefan Giehl <stefan@matomo.org>

* Update CHANGELOG.md

Co-authored-by: Stefan Giehl <stefan@matomo.org>

* Update CHANGELOG.md

Co-authored-by: Stefan Giehl <stefan@matomo.org>

Co-authored-by: Stefan Giehl <stefan@matomo.org>
  • Loading branch information
Peter Zhang and sgiehl committed Dec 7, 2022
1 parent 25c1a7b commit 52eb229
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ This is the Developer Changelog for Matomo platform developers. All changes in o

The Product Changelog at **[matomo.org/changelog](https://matomo.org/changelog)** lets you see more details about any Matomo release, such as the list of new guides and FAQs, security fixes, and links to all closed issues.

## Matomo 4.13.1

### New config.ini.php settings
* Three new config settings `ssl_disallow_self_signed` ,`ssl_verify_peer`, `ssl_verify_peer_name` under [mail] to allow modifying the SSL handling in SMTP request.

## Matomo 4.13.0

### New config.ini.php settings
Expand Down
3 changes: 3 additions & 0 deletions config/global.ini.php
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,9 @@
username = ; SMTP username
password = ; SMTP password
encryption = ; SMTP transport-layer encryption, either 'none', 'ssl', 'tls', or empty (i.e., auto).
ssl_disallow_self_signed = 1 ; set to 0 to allow email server with self signed cert (not recommended)
ssl_verify_peer = 1 ; set to 0 to disable verifying the authenticity of the peer's certificate (not recommended)
ssl_verify_peer_name = 1 ; set to 0 to disable verifying the authenticity of the peer's name (not recommended)

[proxy]
type = BASIC ; proxy type for outbound/outgoing connections; currently, only BASIC is supported
Expand Down
9 changes: 9 additions & 0 deletions core/Mail/Transport.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ public function send(Mail $mail)
{
$phpMailer = new PHPMailer(true);

//check self-signed config in mail
$phpMailer->SMTPOptions = [
'ssl' => [
'verify_peer' => (int)Config::getInstance()->mail['ssl_verify_peer'],
'verify_peer_name' => (int)Config::getInstance()->mail['ssl_verify_peer_name'],
'allow_self_signed' => Config::getInstance()->mail['ssl_disallow_self_signed'] == "1" ? 0 : 1,
],
];

PHPMailer::$validator = 'pcre8';
$phpMailer->CharSet = PHPMailer::CHARSET_UTF8;
$phpMailer->Encoding = PHPMailer::ENCODING_QUOTED_PRINTABLE;
Expand Down

0 comments on commit 52eb229

Please sign in to comment.