From 76e5c66b3837c388e757c73daab9cbfa458e67c2 Mon Sep 17 00:00:00 2001 From: meadsteve Date: Sat, 1 Jun 2013 13:29:59 +0100 Subject: [PATCH] Fixing the email plugin so that it retrieves the system config correctly. --- PHPCI/Plugin/Email.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/PHPCI/Plugin/Email.php b/PHPCI/Plugin/Email.php index a0b88312..09dd4ebd 100644 --- a/PHPCI/Plugin/Email.php +++ b/PHPCI/Plugin/Email.php @@ -43,9 +43,10 @@ class Email implements \PHPCI\Plugin array $options = array(), \Swift_Mailer $mailer = null) { + $phpCiSettings = $phpci->getSystemConfig('phpci'); $this->phpci = $phpci; $this->options = $options; - $this->emailConfig = $phpci->getConfig('email_settings'); + $this->emailConfig = isset($phpCiSettings['email_settings']) ? $phpCiSettings['email_settings'] : array(); // Either a mailer will have been passed in or we load from the // config. @@ -99,12 +100,16 @@ class Email implements \PHPCI\Plugin protected function getMailConfig($configName) { - if (isset($this->emailConfig[$configName])) { + if (isset($this->emailConfig[$configName]) + && $this->emailConfig[$configName] != "") + { return $this->emailConfig[$configName]; } // Check defaults else { switch($configName) { + case 'smtp_address': + return "localhost"; case 'smtp_port': return '25'; case 'from_address':