Skip to content
Snippets Groups Projects
Commit 91effd8d authored by Dominik Eckelmann's avatar Dominik Eckelmann
Browse files

ignore empty header on mail sending

parent 1f61f312
No related branches found
No related tags found
No related merge requests found
......@@ -98,6 +98,9 @@ class mailer_test extends DokuWikiTest {
}
}
/**
* @see https://forum.dokuwiki.org/post/35822
*/
function test_emptyBCCorCC() {
$mail = new TestMailer();
$headers = &$mail->propRef('headers');
......
......@@ -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
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment