diff options
author | Stefan Giehl <stefan@matomo.org> | 2020-05-14 10:52:48 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-14 10:52:48 +0300 |
commit | 0187b71729484a9f173d978239ff0a3cb37a5d7b (patch) | |
tree | 770d517a1268808f85abe291371b84b03a0b3d14 /config | |
parent | fb1be4d50ad1f5c3c2c2915fc42caf1f4fd31a2d (diff) |
Replace Zend Mail with PHPMailer (#15891)
* require composer package phpmailer/phpmailer
* change mail class to use phpmailer instead of Zend_Mail
* removes Zend_Mail and Zend_Mime
* submodule
* fix tests
* enable smtp debug for test mail command
* fix embedded images
* set language for phpmailer
* apply some review feedback
* removes Zend_Validate (#15907)
* don't inline file without cid
* submodule update
* fix test
* decouples Mail class from PHPMailer and moves sending mails to new transport layer
* submodule
* cleanup
* unset xmailer header
* simplify mail attachment handling
* adds methods to add bcc recipients
* change implementation of setReplyTo
Diffstat (limited to 'config')
-rw-r--r-- | config/environment/test.php | 10 | ||||
-rw-r--r-- | config/global.php | 34 |
2 files changed, 5 insertions, 39 deletions
diff --git a/config/environment/test.php b/config/environment/test.php index bfd8e54460..13c5c390cd 100644 --- a/config/environment/test.php +++ b/config/environment/test.php @@ -120,15 +120,15 @@ return array( } }), - array('Test.Mail.send', function (\Zend_Mail $mail) { + array('Test.Mail.send', function (\PHPMailer\PHPMailer\PHPMailer $mail) { $outputFile = PIWIK_INCLUDE_PATH . '/tmp/' . Common::getRequestVar('module', '') . '.' . Common::getRequestVar('action', '') . '.mail.json'; - $outputContent = str_replace("=\n", "", $mail->getBodyHtml($textOnly = true) ?: $mail->getBodyText($textOnly = true)); + $outputContent = str_replace("=\n", "", $mail->Body ?: $mail->AltBody); $outputContent = str_replace("=0A", "\n", $outputContent); $outputContent = str_replace("=3D", "=", $outputContent); $outputContents = array( - 'from' => $mail->getFrom(), - 'to' => $mail->getRecipients(), - 'subject' => $mail->getSubject(), + 'from' => $mail->From, + 'to' => $mail->getAllRecipientAddresses(), + 'subject' => $mail->Subject, 'contents' => $outputContent ); file_put_contents($outputFile, json_encode($outputContents)); diff --git a/config/global.php b/config/global.php index a7ad1c083b..ab4a17119a 100644 --- a/config/global.php +++ b/config/global.php @@ -171,40 +171,6 @@ return array( return $ipsResolved; }, - 'Zend_Mail_Transport_Abstract' => function () { - $mailConfig = Config::getInstance()->mail; - - if (empty($mailConfig['host']) - || $mailConfig['transport'] != 'smtp' - ) { - return; - } - - $smtpConfig = array(); - if (!empty($mailConfig['type'])) { - $smtpConfig['auth'] = strtolower($mailConfig['type']); - } - - if (!empty($mailConfig['username'])) { - $smtpConfig['username'] = $mailConfig['username']; - } - - if (!empty($mailConfig['password'])) { - $smtpConfig['password'] = $mailConfig['password']; - } - - if (!empty($mailConfig['encryption'])) { - $smtpConfig['ssl'] = $mailConfig['encryption']; - } - - if (!empty($mailConfig['port'])) { - $smtpConfig['port'] = $mailConfig['port']; - } - - $host = trim($mailConfig['host']); - $transport = new \Zend_Mail_Transport_Smtp($host, $smtpConfig); - return $transport; - }, 'Piwik\Tracker\VisitorRecognizer' => DI\object() ->constructorParameter('trustCookiesOnly', DI\get('ini.Tracker.trust_visitors_cookies')) |