Rejig setting XMailer to avoid PHP 8.1 issue, fixes #2635

This commit is contained in:
Marcus Bointon 2022-02-16 19:32:11 +01:00
parent 7ac1bd3ac0
commit b930f1587f
No known key found for this signature in database
GPG Key ID: DE31CD6EB646AA24
2 changed files with 6 additions and 6 deletions

View File

@ -2,6 +2,7 @@
## WIP
* If we can't use escaping functions, refuse to do unsafe things
* Avoid PHP 8.1 trim issue
## Version 6.5.3 (November 25th, 2021)
* Wrong commit tagged for the 6.5.2 release!

View File

@ -2637,16 +2637,15 @@ class PHPMailer
$result .= $this->headerLine('X-Priority', $this->Priority);
}
if ('' === $this->XMailer) {
//Empty string for default X-Mailer header
$result .= $this->headerLine(
'X-Mailer',
'PHPMailer ' . self::VERSION . ' (https://github.com/PHPMailer/PHPMailer)'
);
} else {
$myXmailer = trim($this->XMailer);
if ($myXmailer) {
$result .= $this->headerLine('X-Mailer', $myXmailer);
}
}
} elseif (is_string($this->XMailer) && trim($this->XMailer) !== '') {
//Some string
$result .= $this->headerLine('X-Mailer', trim($this->XMailer));
} //Other values result in no X-Mailer header
if ('' !== $this->ConfirmReadingTo) {
$result .= $this->headerLine('Disposition-Notification-To', '<' . $this->ConfirmReadingTo . '>');