Fix extra line break in getSentMIMEMessage(), fixes #589

This commit is contained in:
Synchro 2015-12-18 13:16:51 +01:00
parent bf175028d2
commit 104359d993
3 changed files with 20 additions and 1 deletions

View File

@ -1,6 +1,7 @@
# ChangeLog
* Fix gmail XOAUTH2 scope, thanks to @sherryl4george
* Fix extra line break in getSentMIMEMessage()
## Version 5.2.14 (Nov 1st 2015)
* Allow addresses with IDN (Internationalized Domain Name) in PHP 5.3+, thanks to @fbonzon

View File

@ -2074,7 +2074,7 @@ class PHPMailer
*/
public function getSentMIMEMessage()
{
return $this->MIMEHeader . $this->mailHeader . self::CRLF . $this->MIMEBody;
return rtrim($this->MIMEHeader . $this->mailHeader, "\n\r") . self::CRLF . self::CRLF . $this->MIMEBody;
}
/**

View File

@ -1507,6 +1507,24 @@ EOT;
$this->assertTrue((strpos($b, 'To: "Tim \"The Book\" O\'Reilly" <foo@example.com>') !== false));
}
/**
* Test MIME structure assembly.
*/
public function testMIMEStructure()
{
$this->Mail->Subject .= ': MIME structure';
$this->Mail->Body = '<h3>MIME structure test.</h3>';
$this->Mail->AltBody = 'MIME structure test.';
$this->buildBody();
$this->Mail->preSend();
$this->assertRegExp(
"/Content-Transfer-Encoding: 8bit\r\n\r\n".
"This is a multi-part message in MIME format./",
$this->Mail->getSentMIMEMessage(),
'MIME structure broken'
);
}
/**
* Test BCC-only addressing.
*/