From 65109e6df4397ab5cd8d2c58836a5b13bae68e8d Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 8 Mar 2014 17:37:06 +0100 Subject: [PATCH] Prevent empty headers from having a leading \r\n --- src/Monolog/Handler/NativeMailerHandler.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Monolog/Handler/NativeMailerHandler.php b/src/Monolog/Handler/NativeMailerHandler.php index a96f9f39..e371c224 100644 --- a/src/Monolog/Handler/NativeMailerHandler.php +++ b/src/Monolog/Handler/NativeMailerHandler.php @@ -96,7 +96,7 @@ class NativeMailerHandler extends MailHandler protected function send($content, array $records) { $content = wordwrap($content, $this->maxColumnWidth); - $headers = implode("\r\n", $this->headers) . "\r\n"; + $headers = ltrim(implode("\r\n", $this->headers) . "\r\n", "\r\n"); $headers .= 'Content-type: ' . $this->getContentType() . '; charset=' . $this->getEncoding() . "\r\n"; if ($this->getContentType() == 'text/html' && false === strpos($headers, 'MIME-Version:')) { $headers .= 'MIME-Version: 1.0' . "\r\n"; @@ -133,7 +133,6 @@ class NativeMailerHandler extends MailHandler return $this; } - /** * @param string $encoding * @return self