Skip to content

Commit

Permalink
Merge pull request #1020 from nupplaphil/bug/9142-message-id
Browse files Browse the repository at this point in the history
[phpmailer] Fixes Double Message ID
  • Loading branch information
MrPetovan authored Sep 20, 2020
2 parents a2328af + 5663e61 commit 10d1156
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions phpmailer/phpmailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion securemail/SecureTestEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ public function __construct(App $a, IConfig $config, IPConfig $pConfig, BaseURL

parent::__construct($sitename, $sender_email, $sender_email, $a->user['email'],
$subject, "<p>{$message}</p>", $message,
'', local_user());
[], local_user());
}
}

0 comments on commit 10d1156

Please sign in to comment.