Skip to content
Permalink
Browse files

Allowing strings in cc and bcc. Fixes #1553.

  • Loading branch information...
jrbasso committed Feb 23, 2011
1 parent 21a9904 commit 52163b4b05c3febc9643bc5e81366af7800314a6
@@ -561,11 +561,7 @@ function _createHeader() {
$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 @@ function _createHeader() {
}
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 @@ function testSmtpSendSocket() {
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 @@ function testSendDebug() {
$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);

0 comments on commit 52163b4

Please sign in to comment.
You can’t perform that action at this time.