Skip to content

Commit

Permalink
Fix delivery issues with long subject lines and MailTransport.
Browse files Browse the repository at this point in the history
A few people have reported issues sending wrapped messages via
MailTransport. Removing the new lines has been suggested as a fix.

Refs #2176
  • Loading branch information
markstory committed Oct 23, 2013
1 parent b4a0182 commit 23b23d8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/Cake/Network/Email/MailTransport.php
Expand Up @@ -42,9 +42,10 @@ public function send(CakeEmail $email) {
unset($headers['To']);
$headers = $this->_headersToString($headers, $eol);
$message = implode($eol, $email->message());
$subject = str_replace(array("\r", "\n"), '', $email->subject());

$params = isset($this->_config['additionalParameters']) ? $this->_config['additionalParameters'] : null;
$this->_mail($to, $email->subject(), $message, $headers, $params);
$this->_mail($to, $subject, $message, $headers, $params);
return array('headers' => $headers, 'message' => $message);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Network/Email/MailTransportTest.php
Expand Up @@ -69,7 +69,7 @@ public function testSendData() {
$data .= "Content-Transfer-Encoding: 8bit";

$subject = '=?UTF-8?B?Rm/DuCBCw6VyIELDqXogRm/DuCBCw6VyIELDqXogRm/DuCBCw6VyIELDqXog?=';
$subject .= "\r\n" . ' =?UTF-8?B?Rm/DuCBCw6VyIELDqXo=?=';
$subject .= ' =?UTF-8?B?Rm/DuCBCw6VyIELDqXo=?=';
$this->MailTransport->expects($this->once())->method('_mail')
->with(
'CakePHP <cake@cakephp.org>',
Expand Down

0 comments on commit 23b23d8

Please sign in to comment.