Transform email header string to header array & replace it at various situations.

pull/1020/head
Philipp 2020-09-19 20:14:55 +02:00
parent a6bdb8b742
commit 874cef6a19
No known key found for this signature in database
GPG Key ID: 9A28B7D4FF5667BD
2 changed files with 7 additions and 4 deletions

View File

@ -90,9 +90,12 @@ 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); // Skip the "Message-ID" header because PHP-Mailer is using its own
$mailer->addCustomHeader(trim($name), trim($value)); if ($name == 'Message-Id') {
continue;
}
$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'], parent::__construct($sitename, $sender_email, $sender_email, $a->user['email'],
$subject, "<p>{$message}</p>", $message, $subject, "<p>{$message}</p>", $message,
'', local_user()); [], local_user());
} }
} }