From 466e8083e7daed0926325b5646004f314489ef7f Mon Sep 17 00:00:00 2001 From: buhay Date: Wed, 17 Apr 2013 14:25:34 -0700 Subject: Correction for issue #2388. Updated _build_message() to return a boolean. This prevents email from sending if there is an error trying to attach an attachment to the email. --- system/libraries/Email.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/system/libraries/Email.php b/system/libraries/Email.php index a745d331d..886d7bd91 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -1236,7 +1236,7 @@ class CI_Email { /** * Build Final Body and attachments * - * @return void + * @return boolean */ protected function _build_message() { @@ -1401,7 +1401,7 @@ class CI_Email { $body .= implode($this->newline, $attachment).$this->newline.'--'.$this->_atc_boundary.'--'; $this->_finalbody = ($this->_get_protocol() === 'mail') ? $body : $hdr.$body; - return; + return TRUE; } // -------------------------------------------------------------------- @@ -1606,7 +1606,10 @@ class CI_Email { return $result; } - $this->_build_message(); + if ($this->_build_message() === FALSE) + { + return FALSE; + } $result = $this->_spool_email(); if ($result && $auto_clear) @@ -1665,7 +1668,10 @@ class CI_Email { $this->_bcc_array = $bcc; } - $this->_build_message(); + if ($this->_build_message() === FALSE) + { + return FALSE; + } $this->_spool_email(); } } -- cgit v1.2.3-24-g4f1b From c6da1ef1ffda3e281163b73015c4e95d50bae4b4 Mon Sep 17 00:00:00 2001 From: buhay Date: Thu, 18 Apr 2013 09:06:49 -0700 Subject: Change boolean to bool. Added whitespace. --- system/libraries/Email.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 886d7bd91..10253c796 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -1236,7 +1236,7 @@ class CI_Email { /** * Build Final Body and attachments * - * @return boolean + * @return bool */ protected function _build_message() { @@ -1610,6 +1610,7 @@ class CI_Email { { return FALSE; } + $result = $this->_spool_email(); if ($result && $auto_clear) @@ -1672,6 +1673,7 @@ class CI_Email { { return FALSE; } + $this->_spool_email(); } } -- cgit v1.2.3-24-g4f1b From 83c6efec0a2be84d6ca2c5264b22e4cc26934933 Mon Sep 17 00:00:00 2001 From: buhay Date: Thu, 18 Apr 2013 09:39:01 -0700 Subject: Added to the changelog. --- user_guide_src/source/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 742dacbae..ff7524b2a 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -497,6 +497,7 @@ Bug fixes for 3.0 - Fixed a bug (#78) - :doc:`Cart Library ` didn't allow non-English letters in product names. - Fixed a bug (#77) - :doc:`Database Class ` didn't properly handle the transaction "test mode" flag. - Fixed a bug (#2380) - :doc:`URI Routing ` method ``fetch_method()`` returned 'index' if the requested method name matches its controller name. +- Fixed a bug (#2388) - :doc:`Email library ` Updated the method ``_build_message()`` to return a boolean value. Now it doesn't send an email if there is an error attaching a file to the email. Version 2.1.3 -- cgit v1.2.3-24-g4f1b