Throw an exception if the server doesn't support SMTPUTF8 and we need it

This commit is contained in:
Marcus Bointon 2024-10-17 15:51:53 +02:00
parent c6d62ac4af
commit 0e7b094a32
No known key found for this signature in database
GPG Key ID: DE31CD6EB646AA24
1 changed files with 6 additions and 0 deletions

View File

@ -2098,6 +2098,11 @@ class PHPMailer
if (!$this->smtpConnect($this->SMTPOptions)) {
throw new Exception($this->lang('smtp_connect_failed'), self::STOP_CRITICAL);
}
//If we have recipient addresses that need Unicode support,
//but the server doesn't support it, stop here
if ($this->UseSMTPUTF8 && $this->smtp->getServerExt('SMTPUTF8') === null) {
throw new Exception($this->lang('no_smtputf8'), self::STOP_CRITICAL);
}
//Sender already validated in preSend()
if ('' === $this->Sender) {
$smtp_from = $this->From;
@ -2397,6 +2402,7 @@ class PHPMailer
'smtp_detail' => 'Detail: ',
'smtp_error' => 'SMTP server error: ',
'variable_set' => 'Cannot set or reset variable: ',
'no_smtputf8' => 'Server does not support SMTPUTF8 needed to send to Unicode addresses',
];
if (empty($lang_path)) {
//Calculate an absolute path so it can work if CWD is not here