mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
Allowing strings in cc and bcc. Fixes #1553.
This commit is contained in:
parent
21a9904a71
commit
52163b4b05
2 changed files with 7 additions and 7 deletions
|
@ -561,11 +561,7 @@ class EmailComponent extends Object{
|
|||
$headers = array();
|
||||
|
||||
if ($this->delivery == 'smtp') {
|
||||
if (is_array($this->to)) {
|
||||
$headers['To'] = implode(', ', array_map(array($this, '_formatAddress'), $this->to));
|
||||
} else {
|
||||
$headers['To'] = $this->_formatAddress($this->to);
|
||||
}
|
||||
$headers['To'] = implode(', ', array_map(array($this, '_formatAddress'), (array)$this->to));
|
||||
}
|
||||
$headers['From'] = $this->_formatAddress($this->from);
|
||||
|
||||
|
@ -580,11 +576,11 @@ class EmailComponent extends Object{
|
|||
}
|
||||
|
||||
if (!empty($this->cc)) {
|
||||
$headers['cc'] = implode(', ', array_map(array($this, '_formatAddress'), $this->cc));
|
||||
$headers['Cc'] = implode(', ', array_map(array($this, '_formatAddress'), (array)$this->cc));
|
||||
}
|
||||
|
||||
if (!empty($this->bcc) && $this->delivery != 'smtp') {
|
||||
$headers['Bcc'] = implode(', ', array_map(array($this, '_formatAddress'), $this->bcc));
|
||||
$headers['Bcc'] = implode(', ', array_map(array($this, '_formatAddress'), (array)$this->bcc));
|
||||
}
|
||||
if ($this->delivery == 'smtp') {
|
||||
$headers['Subject'] = $this->_encode($this->subject);
|
||||
|
|
|
@ -740,6 +740,8 @@ HTMLBLOC;
|
|||
function testSendDebug() {
|
||||
$this->Controller->EmailTest->to = 'postmaster@localhost';
|
||||
$this->Controller->EmailTest->from = 'noreply@example.com';
|
||||
$this->Controller->EmailTest->cc = 'cc@example.com';
|
||||
$this->Controller->EmailTest->bcc = 'bcc@example.com';
|
||||
$this->Controller->EmailTest->subject = 'Cake Debug Test';
|
||||
$this->Controller->EmailTest->replyTo = 'noreply@example.com';
|
||||
$this->Controller->EmailTest->template = null;
|
||||
|
@ -752,6 +754,8 @@ HTMLBLOC;
|
|||
$this->assertPattern('/Subject: Cake Debug Test\n/', $result);
|
||||
$this->assertPattern('/Reply-To: noreply@example.com\n/', $result);
|
||||
$this->assertPattern('/From: noreply@example.com\n/', $result);
|
||||
$this->assertPattern('/Cc: cc@example.com\n/', $result);
|
||||
$this->assertPattern('/Bcc: bcc@example.com\n/', $result);
|
||||
$this->assertPattern('/Date: ' . preg_quote(date(DATE_RFC2822)) . '\n/', $result);
|
||||
$this->assertPattern('/X-Mailer: CakePHP Email Component\n/', $result);
|
||||
$this->assertPattern('/Content-Type: text\/plain; charset=UTF-8\n/', $result);
|
||||
|
|
Loading…
Add table
Reference in a new issue