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
This commit is contained in:
mark_story 2010-10-18 22:06:12 -04:00
parent 61864a3b76
commit 1c25e627ad
2 changed files with 5 additions and 5 deletions

View file

@ -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] . '>');

View file

@ -1191,12 +1191,12 @@ HTMLBLOC;
$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>');
}
}