diff --git a/src/Monolog/Handler/NativeMailerHandler.php b/src/Monolog/Handler/NativeMailerHandler.php index c7ac63a0..e659cb13 100644 --- a/src/Monolog/Handler/NativeMailerHandler.php +++ b/src/Monolog/Handler/NativeMailerHandler.php @@ -25,6 +25,7 @@ class NativeMailerHandler extends MailHandler protected $headers = array( 'Content-type: text/plain; charset=utf-8' ); + protected $maxColumnWidth; /** * @param string|array $to The receiver of the mail @@ -32,13 +33,15 @@ class NativeMailerHandler extends MailHandler * @param string $from The sender of the mail * @param integer $level The minimum logging level at which this handler will be triggered * @param boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param int $maxColumnWidth The maximum column width that the message lines will have */ - public function __construct($to, $subject, $from, $level = Logger::ERROR, $bubble = true) + public function __construct($to, $subject, $from, $level = Logger::ERROR, $bubble = true, $maxColumnWidth = 70) { parent::__construct($level, $bubble); $this->to = is_array($to) ? $to : array($to); $this->subject = $subject; $this->addHeader(sprintf('From: %s', $from)); + $this->maxColumnWidth = $maxColumnWidth; } /** @@ -59,7 +62,7 @@ class NativeMailerHandler extends MailHandler */ protected function send($content, array $records) { - $content = wordwrap($content, 70); + $content = wordwrap($content, $this->maxColumnWidth); $headers = implode("\r\n", $this->headers) . "\r\n"; foreach ($this->to as $to) { mail($to, $this->subject, $content, $headers);