]> git.mxchange.org Git - friendica-addons.git/commitdiff
Transform email header string to header array & replace it at various situations.
authorPhilipp <admin@philipp.info>
Sat, 19 Sep 2020 18:14:55 +0000 (20:14 +0200)
committerPhilipp <admin@philipp.info>
Sat, 19 Sep 2020 18:14:55 +0000 (20:14 +0200)
phpmailer/phpmailer.php
securemail/SecureTestEmail.php

index e9a3c66ea90e869b3a922ccb162d418f9d000710..2b38f07a6ac2d464f69dfa3ac2f9d2822cc9bbb5 100644 (file)
@@ -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)));
                        }
                }
 
index e15ef601fc833221adf7ba138b80d2e3aef08ce4..8341f5451b1f7bd84fe461226fa73d0500680b1c 100644 (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());
        }
 }