From 1f61f312a78e212aaa4a4bc3f60961036ec07fd7 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Fri, 23 Nov 2012 18:48:09 +0100 Subject: remove empty BCC/CC mail headers Empty BCC/CC headers may cause errors on IIS. --- inc/Mailer.class.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'inc/Mailer.class.php') diff --git a/inc/Mailer.class.php b/inc/Mailer.class.php index cbd1eb0a9..256a76d22 100644 --- a/inc/Mailer.class.php +++ b/inc/Mailer.class.php @@ -553,6 +553,7 @@ class Mailer { * @returns string the headers */ protected function prepareHeaders() { + $this->removeEmptyBccOrCcHeader(); $headers = ''; foreach($this->headers as $key => $val) { $headers .= "$key: $val".MAILHEADER_EOL; @@ -560,6 +561,16 @@ class Mailer { return $headers; } + /** + * Removes empty BCC and CC Header. + * + * Empty BCC/CC Header can cause an error with Microsoft IIS. + */ + protected function removeEmptyBccOrCcHeader() { + if (isset($this->headers['Bcc']) && empty($this->headers['Bcc'])) unset($this->headers['Bcc']); + if (isset($this->headers['Cc']) && empty($this->headers['Cc'])) unset($this->headers['Cc']); + } + /** * return a full email with all headers * -- cgit v1.2.3 From 91effd8de07e4afc59b6763ac72b268f58cfc941 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Fri, 23 Nov 2012 19:55:44 +0100 Subject: ignore empty header on mail sending --- inc/Mailer.class.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'inc/Mailer.class.php') diff --git a/inc/Mailer.class.php b/inc/Mailer.class.php index 256a76d22..f1492be9b 100644 --- a/inc/Mailer.class.php +++ b/inc/Mailer.class.php @@ -553,24 +553,14 @@ class Mailer { * @returns string the headers */ protected function prepareHeaders() { - $this->removeEmptyBccOrCcHeader(); $headers = ''; foreach($this->headers as $key => $val) { + if ($val === '') continue; $headers .= "$key: $val".MAILHEADER_EOL; } return $headers; } - /** - * Removes empty BCC and CC Header. - * - * Empty BCC/CC Header can cause an error with Microsoft IIS. - */ - protected function removeEmptyBccOrCcHeader() { - if (isset($this->headers['Bcc']) && empty($this->headers['Bcc'])) unset($this->headers['Bcc']); - if (isset($this->headers['Cc']) && empty($this->headers['Cc'])) unset($this->headers['Cc']); - } - /** * return a full email with all headers * -- cgit v1.2.3