From: Philipp Date: Sat, 19 Sep 2020 18:14:55 +0000 (+0200) Subject: Transform email header string to header array & replace it at various situations. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=874cef6a19fb9fd9f12c11d2477170baa4a7eea2;p=friendica-addons.git Transform email header string to header array & replace it at various situations. --- diff --git a/phpmailer/phpmailer.php b/phpmailer/phpmailer.php index e9a3c66e..2b38f07a 100644 --- a/phpmailer/phpmailer.php +++ b/phpmailer/phpmailer.php @@ -90,9 +90,12 @@ 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) { + // Skip the "Message-ID" header because PHP-Mailer is using its own + if ($name == 'Message-Id') { + continue; + } + $mailer->addCustomHeader(trim($name), trim(implode("\n", $values))); } } diff --git a/securemail/SecureTestEmail.php b/securemail/SecureTestEmail.php index e15ef601..8341f545 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()); } }