Permalink
Browse files

Applying patch from 'Mark Mitchell' fixes issues with sending Email v…

…ia smtp. Which were incorrect based on previous patches given for ticket #1100.


Fixes #1205, Fixes #1204
  • Loading branch information...
markstory committed Oct 19, 2010
1 parent 61864a3 commit 1c25e627ad6891084751a286eb1457cc78eaac2e
@@ -745,9 +745,9 @@ function _encode($subject) {
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] . '>');
@@ -1191,12 +1191,12 @@ function testFormatAddressAliases() {
$this->assertEqual($result, '<email@example.com>');
$result = $this->Controller->EmailTest->formatAddress('email@example.com', true);
- $this->assertEqual($result, ' <email@example.com>');
+ $this->assertEqual($result, '<email@example.com>');
$result = $this->Controller->EmailTest->formatAddress('<email@example.com>', true);
- $this->assertEqual($result, ' <email@example.com>');
+ $this->assertEqual($result, '<email@example.com>');
$result = $this->Controller->EmailTest->formatAddress('alias name <email@example.com>', true);
- $this->assertEqual($result, ' <email@example.com>');
+ $this->assertEqual($result, '<email@example.com>');
}
}

0 comments on commit 1c25e62

Please sign in to comment.