1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-05 20:57:36 +02:00

Prevent empty headers from having a leading \r\n

This commit is contained in:
Jordi Boggiano
2014-03-08 17:37:06 +01:00
parent 5d91d4145f
commit 65109e6df4

View File

@@ -96,7 +96,7 @@ class NativeMailerHandler extends MailHandler
protected function send($content, array $records) protected function send($content, array $records)
{ {
$content = wordwrap($content, $this->maxColumnWidth); $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"; $headers .= 'Content-type: ' . $this->getContentType() . '; charset=' . $this->getEncoding() . "\r\n";
if ($this->getContentType() == 'text/html' && false === strpos($headers, 'MIME-Version:')) { if ($this->getContentType() == 'text/html' && false === strpos($headers, 'MIME-Version:')) {
$headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n";
@@ -133,7 +133,6 @@ class NativeMailerHandler extends MailHandler
return $this; return $this;
} }
/** /**
* @param string $encoding * @param string $encoding
* @return self * @return self