Bugfix invalid DKIM-signature with zero To-addresses

When using PHP's mail() function, and when there are no To-addressees (e.g. only BCC), then the DKIM-signature was not correct. There was a discrepancy between how mail() was called (empty $to) versus the DKIM-signature ('undisclosed-recipients:;').
This commit is contained in:
sverpoorten 2022-08-21 21:13:01 +02:00 committed by GitHub
parent fadcb6abe1
commit 0bddcf9141
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -1892,6 +1892,12 @@ class PHPMailer
$toArr[] = $this->addrFormat($toaddr);
}
$to = 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(trim($to) == '') { $to = 'undisclosed-recipients:;'; }
$params = null;
//This sets the SMTP envelope sender which gets turned into a return-path header by the receiver