Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <tsteur@users.noreply.github.com>2019-01-29 08:07:21 +0300
committerdiosmosis <diosmosis@users.noreply.github.com>2019-01-29 08:07:21 +0300
commitcec026c1dc1a77a3e714ee85c601301cd298b43f (patch)
treebe82b6e93015bd85e6fd7fb0032b202519faa46b /config/global.php
parentc826e18dd078296a97f0ad86167a8d6b15406964 (diff)
Add possibility to change mail transport through DI (#14041)
* Add possibility to change mail transport through DI * Fix test.
Diffstat (limited to 'config/global.php')
-rw-r--r--config/global.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/config/global.php b/config/global.php
index 8320959983..8833f4841b 100644
--- a/config/global.php
+++ b/config/global.php
@@ -155,6 +155,40 @@ 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;
+ },
'Zend_Validate_EmailAddress' => function () {
return new \Zend_Validate_EmailAddress(array(