Skip to content

Commit

Permalink
Adapted the mail and smtp transports to the getHeaders return.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed Apr 13, 2011
1 parent 6930ba6 commit 131a62f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions cake/libs/email/mail_transport.php
Expand Up @@ -35,9 +35,11 @@ public function send(CakeEmail $email) {
if (!$eol) {
$eol = PHP_EOL;
}
$header = $this->_headersToString($email->getHeaders(true, true, false), $eol);
$headers = $email->getHeaders(array_fill_keys(array('from', 'replyTo', 'readReceipt', 'returnPath', 'to', 'cc', 'bcc'), true));
$to = $headers['To'];
unset($headers['To']);
$header = $this->_headersToString($headers, $eol);
$message = implode($eol, $email->getMessage());
$to = key($email->getTo());
if (ini_get('safe_mode')) {
return @mail($to, $email->getSubject(), $message, $header);
}
Expand Down
5 changes: 3 additions & 2 deletions cake/libs/email/smtp_transport.php
Expand Up @@ -160,9 +160,10 @@ protected function _sendRcpt() {
protected function _sendData() {
$this->_smtpSend('DATA', '354');

$header = $this->_headersToString($this->_cakeEmail->getHeaders(true, false, true));
$headers = $this->_cakeEmail->getHeaders(array_fill_keys(array('from', 'replyTo', 'readReceipt', 'returnPath', 'to', 'cc', 'bcc', 'subject'), true));
$headers = $this->_headersToString($headers);
$message = implode("\r\n", $this->_cakeEmail->getMessage());
$this->_smtpSend($header . "\r\n\r\n" . $message . "\r\n\r\n\r\n.");
$this->_smtpSend($headers . "\r\n\r\n" . $message . "\r\n\r\n\r\n.");
}

/**
Expand Down

0 comments on commit 131a62f

Please sign in to comment.