From 8df1ae2d7e0fd441f7a1fc481c76c5c1edfadf23 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 19 Oct 2012 11:20:54 +0300 Subject: Fix another mailing issue (based on #1281) --- system/libraries/Email.php | 16 ++++++++++------ user_guide_src/source/changelog.rst | 1 + 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 795db2043..c1130e915 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -742,8 +742,8 @@ class CI_Email { /** * Build alternative plain text message * - * This public function provides the raw message for use - * in plain-text headers of HTML-formatted emails. + * Provides the raw message for use in plain-text headers of + * HTML-formatted emails. * If the user hasn't specified his own alternative message * it creates one by stripping the HTML * @@ -751,9 +751,11 @@ class CI_Email { */ protected function _get_alt_message() { - if ($this->alt_message !== '') + if ( ! empty($this->alt_message)) { - return $this->word_wrap($this->alt_message, 76); + return ($this->wordwrap) + ? $this->word_wrap($this->alt_message, 76) + : $this->alt_message; } $body = preg_match('/\(.*)\<\/body\>/si', $this->_body, $match) ? $match[1] : $this->_body; @@ -764,7 +766,9 @@ class CI_Email { $body = str_replace(str_repeat("\n", $i), "\n\n", $body); } - return $this->word_wrap($body, 76); + return ($this->wordwrap) + ? $this->word_wrap($body, 76) + : $body; } // -------------------------------------------------------------------- @@ -773,7 +777,7 @@ class CI_Email { * Word Wrap * * @param string - * @param int + * @param int line-length limit * @return string */ public function word_wrap($str, $charlim = NULL) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 6487c5b3f..4ee382fce 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -368,6 +368,7 @@ Bug fixes for 3.0 - Fixed a bug where the :doc:`Session Library ` accepted cookies with *last_activity* values being in the future. - Fixed a bug (#1897) - :doc:`Email Library ` triggered PHP E_WARNING errors when *mail* protocol used and ``to()`` is never called. - Fixed a bug (#1409) - :doc:`Email Library ` didn't properly handle multibyte characters when applying Q-encoding to headers. +- Fixed a bug where :doc:`Email Library ` didn't honor it's *wordwrap* setting while handling alternative messages. Version 2.1.3 ============= -- cgit v1.2.3-24-g4f1b