mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
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:
parent
61864a3b76
commit
1c25e627ad
2 changed files with 5 additions and 5 deletions
|
@ -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] . '>');
|
||||
|
|
|
@ -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>');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue