Upstream PHPMailer/PHPMailer state of the touched files before 5b7250d8da

This commit is contained in:
upstream committed 2026-10-03 18:30:36 +02:00
1 parent 1ac61eecb6
commit ce1b3ed5e6
1 file changed
+6 -8
+6 -8
View File
@@ -2090,8 +2090,7 @@ class PHPMailer
foreach ($this->to as $toaddr) { foreach ($this->to as $toaddr) {
$toArr[] = $this->addrFormat($toaddr); $toArr[] = $this->addrFormat($toaddr);
} }
//Fold long lists the same way as the To header, mail() keeps CRLF + WSP folds intact $to = trim(implode(', ', $toArr));
$to = trim(substr($this->addrAppend('To', $this->to), strlen('To:')));
//If there are no To-addresses (e.g. when sending only to BCC-addresses) //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. //the following should be added to get a correct DKIM-signature.
@@ -2648,18 +2647,17 @@ class PHPMailer
$addresses[] = $this->addrFormat($address); $addresses[] = $this->addrFormat($address);
} }
//Fold between addresses so that no line exceeds the RFC 2822 line length limit //Fold between addresses so that no line exceeds the RFC 5322 limit,
//leaving room for the comma at the end of a folded line
$header = $type . ': ' . array_shift($addresses); $header = $type . ': ' . array_shift($addresses);
$lineLength = strlen($header); $lineLength = strlen($header);
foreach ($addresses as $address) { foreach ($addresses as $address) {
//The address goes after ', ' and must still leave room for the ',' that ends if ($lineLength + strlen($address) + 3 > static::MAX_LINE_LENGTH) {
//the line if the next address gets folded
if ($lineLength + strlen(', ') + strlen($address) + strlen(',') > static::MAX_LINE_LENGTH) {
$header .= ',' . static::$LE . ' ' . $address; $header .= ',' . static::$LE . ' ' . $address;
$lineLength = strlen(' ') + strlen($address); $lineLength = strlen($address) + 1;
} else { } else {
$header .= ', ' . $address; $header .= ', ' . $address;
$lineLength += strlen(', ') + strlen($address); $lineLength += strlen($address) + 2;
} }
} }