diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2019-01-29 08:07:21 +0300 |
---|---|---|
committer | diosmosis <diosmosis@users.noreply.github.com> | 2019-01-29 08:07:21 +0300 |
commit | cec026c1dc1a77a3e714ee85c601301cd298b43f (patch) | |
tree | be82b6e93015bd85e6fd7fb0032b202519faa46b /core | |
parent | c826e18dd078296a97f0ad86167a8d6b15406964 (diff) |
Add possibility to change mail transport through DI (#14041)
* Add possibility to change mail transport through DI
* Fix test.
Diffstat (limited to 'core')
-rw-r--r-- | core/Mail.php | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/core/Mail.php b/core/Mail.php index 55119ca93b..42f7312832 100644 --- a/core/Mail.php +++ b/core/Mail.php @@ -100,37 +100,11 @@ class Mail extends Zend_Mail */ private function initSmtpTransport() { - $mailConfig = Config::getInstance()->mail; - - if (empty($mailConfig['host']) - || $mailConfig['transport'] != 'smtp' - ) { + $tr = StaticContainer::get('Zend_Mail_Transport_Abstract'); + if (empty($tr)) { 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']); - $tr = new \Zend_Mail_Transport_Smtp($host, $smtpConfig); Mail::setDefaultTransport($tr); } |