diff --git a/phpmailer/phpmailer.php b/phpmailer/phpmailer.php index e9a3c66ea..5b43c8f19 100644 --- a/phpmailer/phpmailer.php +++ b/phpmailer/phpmailer.php @@ -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))); + } } } diff --git a/securemail/SecureTestEmail.php b/securemail/SecureTestEmail.php index e15ef601f..8341f5451 100644 --- a/securemail/SecureTestEmail.php +++ b/securemail/SecureTestEmail.php @@ -54,6 +54,6 @@ class SecureTestEmail extends Email parent::__construct($sitename, $sender_email, $sender_email, $a->user['email'], $subject, "
{$message}
", $message, - '', local_user()); + [], local_user()); } }