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 3f6bee0 commit 48c2c16
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions cake/libs/controller/components/email.php
Expand Up @@ -619,9 +619,9 @@ function __encode($subject) {
function __formatAddress($string, $smtp = false) { function __formatAddress($string, $smtp = false) {
$hasAlias = preg_match('/((.*)\s)?<(.+)>/', $string, $matches); $hasAlias = preg_match('/((.*)\s)?<(.+)>/', $string, $matches);
if ($smtp && $hasAlias) { if ($smtp && $hasAlias) {
return $this->__strip(' <' . $matches[3] . '>'); return $this->__strip('<' . $matches[3] . '>');
} elseif ($smtp) { } elseif ($smtp) {
return $this->__strip(' <' . $string . '>'); return $this->__strip('<' . $string . '>');
} }
if ($hasAlias && !empty($matches[2])) { if ($hasAlias && !empty($matches[2])) {
return $this->__strip($matches[2] . ' <' . $matches[3] . '>'); return $this->__strip($matches[2] . ' <' . $matches[3] . '>');
Expand Down Expand Up @@ -796,4 +796,4 @@ function __debug() {
} }


} }
?> ?>
6 changes: 3 additions & 3 deletions cake/tests/cases/libs/controller/components/email.test.php
Expand Up @@ -694,13 +694,13 @@ function testFormatAddressAliases() {
$this->assertEqual($result, '<email@example.com>'); $this->assertEqual($result, '<email@example.com>');


$result = $this->Controller->EmailTest->formatAddress('email@example.com', true); $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); $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); $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 48c2c16

Please sign in to comment.