From 1c25e627ad6891084751a286eb1457cc78eaac2e Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 18 Oct 2010 22:06:12 -0400 Subject: [PATCH] Applying patch from 'Mark Mitchell' fixes issues with sending Email via smtp. Which were incorrect based on previous patches given for ticket #1100. Fixes #1205, Fixes #1204 --- cake/libs/controller/components/email.php | 4 ++-- cake/tests/cases/libs/controller/components/email.test.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cake/libs/controller/components/email.php b/cake/libs/controller/components/email.php index 06e6210d8..1812a33ba 100755 --- a/cake/libs/controller/components/email.php +++ b/cake/libs/controller/components/email.php @@ -745,9 +745,9 @@ class EmailComponent extends Object{ function _formatAddress($string, $smtp = false) { $hasAlias = preg_match('/((.*)\s)?<(.+)>/', $string, $matches); if ($smtp && $hasAlias) { - return $this->_strip(' <' . $matches[3] . '>'); + return $this->_strip('<' . $matches[3] . '>'); } elseif ($smtp) { - return $this->_strip(' <' . $string . '>'); + return $this->_strip('<' . $string . '>'); } if ($hasAlias && !empty($matches[2])) { return $this->_strip($matches[2] . ' <' . $matches[3] . '>'); diff --git a/cake/tests/cases/libs/controller/components/email.test.php b/cake/tests/cases/libs/controller/components/email.test.php index 1d43deb3b..8d7f588e6 100755 --- a/cake/tests/cases/libs/controller/components/email.test.php +++ b/cake/tests/cases/libs/controller/components/email.test.php @@ -1191,12 +1191,12 @@ HTMLBLOC; $this->assertEqual($result, ''); $result = $this->Controller->EmailTest->formatAddress('email@example.com', true); - $this->assertEqual($result, ' '); + $this->assertEqual($result, ''); $result = $this->Controller->EmailTest->formatAddress('', true); - $this->assertEqual($result, ' '); + $this->assertEqual($result, ''); $result = $this->Controller->EmailTest->formatAddress('alias name ', true); - $this->assertEqual($result, ' '); + $this->assertEqual($result, ''); } }