Skip to content

Commit

Permalink
Applying patch from 'Mark Mitchell' fixes issues with sending Email v…
Browse files Browse the repository at this point in the history
…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 1c25e62
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cake/libs/controller/components/email.php
Expand Up @@ -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] . '>');
Expand Down
6 changes: 3 additions & 3 deletions cake/tests/cases/libs/controller/components/email.test.php
Expand Up @@ -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.