From 1501cc8cea9ecc316e354250cc9aed0894e3433f Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Sun, 11 Dec 2011 23:42:32 +0100 Subject: [PATCH] MDL-30575 yet more mail header cleanup --- lib/phpmailer/class.phpmailer.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/phpmailer/class.phpmailer.php b/lib/phpmailer/class.phpmailer.php index d5ccc706bb3..53d36682152 100644 --- a/lib/phpmailer/class.phpmailer.php +++ b/lib/phpmailer/class.phpmailer.php @@ -653,11 +653,11 @@ class PHPMailer */ function AddrFormat($addr) { if(empty($addr[1])) - $formatted = $addr[0]; + $formatted = preg_replace('/[\r\n]+/', '', $addr[0]); // Moodle modification else { - $formatted = $this->EncodeHeader($addr[1], 'phrase') . " <" . - $addr[0] . ">"; + $formatted = $this->EncodeHeader($addr[1], 'phrase') . " <" . + preg_replace('/[\r\n]+/', '', $addr[0]) . ">"; // Moodle modification } return $formatted; @@ -780,9 +780,9 @@ class PHPMailer $result .= $this->HeaderLine("Date", $this->RFCDate()); if($this->Sender == "") - $result .= $this->HeaderLine("Return-Path", trim($this->From)); + $result .= $this->HeaderLine("Return-Path", trim(preg_replace('/[\r\n]+/', '', $this->From))); // Moodle modification else - $result .= $this->HeaderLine("Return-Path", trim($this->Sender)); + $result .= $this->HeaderLine("Return-Path", trim(preg_replace('/[\r\n]+/', '', $this->Sender))); // Moodle modification // To be created automatically by mail() if($this->Mailer != "mail")