From 0b8a3069ebd8e366434d778aa8a71ec55543c6c9 Mon Sep 17 00:00:00 2001 From: Ceeram Date: Wed, 24 Aug 2011 16:58:51 +0200 Subject: [PATCH] removing duplicate code, config() already applies configs now --- lib/Cake/Network/Email/CakeEmail.php | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/lib/Cake/Network/Email/CakeEmail.php b/lib/Cake/Network/Email/CakeEmail.php index 579daee9677..8f447bc3c10 100644 --- a/lib/Cake/Network/Email/CakeEmail.php +++ b/lib/Cake/Network/Email/CakeEmail.php @@ -553,7 +553,7 @@ public function setHeaders($headers) { * Add header for the message * * @param array $headers - * @return mixed $this + * @return object $this * @throws SocketException */ public function addHeaders($headers) { @@ -914,27 +914,12 @@ public function config($config = null) { */ public function send($content = null) { if (is_string($this->_config)) { - if (!config('email')) { - throw new SocketException(__d('cake', '%s not found.', APP . 'Config' . DS . 'email.php')); - } - $configs = new EmailConfig(); - if (!isset($configs->{$this->_config})) { - throw new SocketException(__d('cake', 'Unknown email configuration "%s".', $this->_config)); - } - $config = $configs->{$this->_config}; - if (isset($config['transport'])) { - $this->transport($config['transport']); - } - } else { - $config = $this->_config; + $this->config($this->_config); } + $config = $this->_config; if (empty($this->_from)) { - if (!empty($config['from'])) { - $this->from($config['from']); - } else { - throw new SocketException(__d('cake', 'From is not specified.')); - } + throw new SocketException(__d('cake', 'From is not specified.')); } if (empty($this->_to) && empty($this->_cc) && empty($this->_bcc)) { throw new SocketException(__d('cake', 'You need specify one destination on to, cc or bcc.'));