Permalink
Browse files

Fix delivery issues with long subject lines and MailTransport.

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...
1 parent b4a0182 commit 23b23d805080b1490d7aecc8cfc5c1d4be115ce7 @markstory markstory committed Oct 23, 2013
@@ -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);
}
@@ -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>',

0 comments on commit 23b23d8

Please sign in to comment.