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, ''); } }