Merge pull request #1020 from nupplaphil/bug/9142-message-id

[phpmailer] Fixes Double Message ID
pull/1021/head
Hypolite Petovan 2020-09-19 22:11:14 -04:00 committed by GitHub
commit 10d1156a77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -90,9 +90,14 @@ function phpmailer_emailer_send_prepare(App $a, IEmail &$email)
// additional headers
if (!empty($email->getAdditionalMailHeader())) {
foreach (explode("\n", trim($email->getAdditionalMailHeader())) as $header_line) {
list($name, $value) = explode(':', $header_line, 2);
$mailer->addCustomHeader(trim($name), trim($value));
foreach ($email->getAdditionalMailHeader() as $name => $values) {
// Set the "Message-ID" header for PHP-Mailer directly
if ($name == 'Message-Id') {
// implode all values to one entry, because there's only one value possible
$mailer->MessageID = trim(implode("", $values));
} else {
$mailer->addCustomHeader(trim($name), trim(implode("\n", $values)));
}
}
}

View File

@ -54,6 +54,6 @@ class SecureTestEmail extends Email
parent::__construct($sitename, $sender_email, $sender_email, $a->user['email'],
$subject, "<p>{$message}</p>", $message,
'', local_user());
[], local_user());
}
}