[phpmailer] Fixes Double Message ID #1020
|
@ -90,9 +90,14 @@ function phpmailer_emailer_send_prepare(App $a, IEmail &$email)
|
||||||
|
|
||||||
// additional headers
|
// additional headers
|
||||||
if (!empty($email->getAdditionalMailHeader())) {
|
if (!empty($email->getAdditionalMailHeader())) {
|
||||||
foreach (explode("\n", trim($email->getAdditionalMailHeader())) as $header_line) {
|
foreach ($email->getAdditionalMailHeader() as $name => $values) {
|
||||||
list($name, $value) = explode(':', $header_line, 2);
|
// Set the "Message-ID" header for PHP-Mailer directly
|
||||||
$mailer->addCustomHeader(trim($name), trim($value));
|
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)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,6 @@ class SecureTestEmail extends Email
|
||||||
|
|
||||||
parent::__construct($sitename, $sender_email, $sender_email, $a->user['email'],
|
parent::__construct($sitename, $sender_email, $sender_email, $a->user['email'],
|
||||||
$subject, "<p>{$message}</p>", $message,
|
$subject, "<p>{$message}</p>", $message,
|
||||||
'', local_user());
|
[], local_user());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue