Skip to content

Commit

Permalink
Merge pull request #2754 from sverpoorten/master
Browse files Browse the repository at this point in the history
Bugfix invalid DKIM-signature with zero To-addresses
  • Loading branch information
Synchro committed Aug 22, 2022
2 parents fadcb6a + 6b7dc4e commit 47adaac
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/PHPMailer.php
Expand Up @@ -1891,7 +1891,14 @@ protected function mailSend($header, $body)
foreach ($this->to as $toaddr) {
$toArr[] = $this->addrFormat($toaddr);
}
$to = implode(', ', $toArr);
$to = trim(implode(', ', $toArr));

//If there are no To-addresses (e.g. when sending only to BCC-addresses)
//the following should be added to get a correct DKIM-signature.
//Compare with $this->preSend()
if ($to === '') {
$to = 'undisclosed-recipients:;';
}

$params = null;
//This sets the SMTP envelope sender which gets turned into a return-path header by the receiver
Expand Down

0 comments on commit 47adaac

Please sign in to comment.