diff --git a/src/PHPMailer.php b/src/PHPMailer.php index 8f4188d..547024e 100644 --- a/src/PHPMailer.php +++ b/src/PHPMailer.php @@ -3320,8 +3320,9 @@ class PHPMailer @unlink($signed); //The message returned by openssl contains both headers and body, so need to split them up $parts = explode("\n\n", $body, 2); - $this->MIMEHeader .= $parts[0] . static::$LE . static::$LE; - $body = $parts[1]; + //openssl emits bare LF breaks, which SMTP servers may reject + $this->MIMEHeader .= static::normalizeBreaks($parts[0]) . static::$LE . static::$LE; + $body = static::normalizeBreaks($parts[1]); } else { @unlink($signed); throw new Exception(self::lang('signing') . openssl_error_string()); diff --git a/test/PHPMailer/PHPMailerTest.php b/test/PHPMailer/PHPMailerTest.php index 96d22b0..48a6b42 100644 --- a/test/PHPMailer/PHPMailerTest.php +++ b/test/PHPMailer/PHPMailerTest.php @@ -971,6 +971,11 @@ EOT; $msg = $this->Mail->getSentMIMEMessage(); self::assertStringNotContainsString("\r\n\r\nMIME-Version:", $msg, 'Incorrect MIME headers'); + self::assertSame( + 0, + preg_match_all("/(?