diff --git a/core/composer.lock b/core/composer.lock index 5c5aed89d7..eaa3b0e60a 100644 --- a/core/composer.lock +++ b/core/composer.lock @@ -4209,16 +4209,16 @@ }, { "name": "phpmailer/phpmailer", - "version": "v7.1.1", + "version": "v7.4.1", "source": { "type": "git", "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "1bc1716a507a65e039d4ac9d9adebbbd0d346e15" + "reference": "4ddb1d8485a4216f8a97beaf185361669c619dc2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/1bc1716a507a65e039d4ac9d9adebbbd0d346e15", - "reference": "1bc1716a507a65e039d4ac9d9adebbbd0d346e15", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/4ddb1d8485a4216f8a97beaf185361669c619dc2", + "reference": "4ddb1d8485a4216f8a97beaf185361669c619dc2", "shasum": "" }, "require": { @@ -4229,11 +4229,11 @@ }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^1.0", - "doctrine/annotations": "^1.2.6 || ^1.13.3", + "doctrine/annotations": "^1.2.6", "php-parallel-lint/php-console-highlighter": "^1.0.0", "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^10.0.0@dev", - "squizlabs/php_codesniffer": "^3.13.5", + "squizlabs/php_codesniffer": "^3.13.6 || ^4.0.2", "yoast/phpunit-polyfills": "^1.0.4" }, "suggest": { @@ -4242,8 +4242,8 @@ "ext-imap": "Needed to support advanced email address parsing according to RFC822", "ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses", "ext-openssl": "Needed for secure SMTP sending and DKIM signing", - "greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication", "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication", + "ipwsystems/oauth2-entraid-provider": "Needed for Microsoft Azure (Entra ID) XOAUTH2 authentication", "league/oauth2-google": "Needed for Google XOAUTH2 authentication", "psr/log": "For optional PSR-3 debug logging", "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)", @@ -4279,7 +4279,7 @@ "description": "PHPMailer is a full-featured email creation and transfer class for PHP", "support": { "issues": "https://github.com/PHPMailer/PHPMailer/issues", - "source": "https://github.com/PHPMailer/PHPMailer/tree/v7.1.1" + "source": "https://github.com/PHPMailer/PHPMailer/tree/v7.4.1" }, "funding": [ { @@ -4287,7 +4287,8 @@ "type": "github" } ], - "time": "2026-05-18T08:06:14+00:00" + "time": "2026-12-04T10:35:10+00:00", + "published-time": "2026-12-04T10:35:39+00:00" }, { "name": "phpoption/phpoption", @@ -9551,5 +9552,5 @@ "ext-zip": "*" }, "platform-dev": {}, - "plugin-api-version": "2.9.0" + "plugin-api-version": "2.11.0" } diff --git a/core/vendor/composer/installed.json b/core/vendor/composer/installed.json index 3f8bac69e4..2fe9900f8f 100644 --- a/core/vendor/composer/installed.json +++ b/core/vendor/composer/installed.json @@ -4389,17 +4389,17 @@ }, { "name": "phpmailer/phpmailer", - "version": "v7.1.1", - "version_normalized": "7.1.1.0", + "version": "v7.4.1", + "version_normalized": "7.4.1.0", "source": { "type": "git", "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "1bc1716a507a65e039d4ac9d9adebbbd0d346e15" + "reference": "4ddb1d8485a4216f8a97beaf185361669c619dc2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/1bc1716a507a65e039d4ac9d9adebbbd0d346e15", - "reference": "1bc1716a507a65e039d4ac9d9adebbbd0d346e15", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/4ddb1d8485a4216f8a97beaf185361669c619dc2", + "reference": "4ddb1d8485a4216f8a97beaf185361669c619dc2", "shasum": "" }, "require": { @@ -4410,11 +4410,11 @@ }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^1.0", - "doctrine/annotations": "^1.2.6 || ^1.13.3", + "doctrine/annotations": "^1.2.6", "php-parallel-lint/php-console-highlighter": "^1.0.0", "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^10.0.0@dev", - "squizlabs/php_codesniffer": "^3.13.5", + "squizlabs/php_codesniffer": "^3.13.6 || ^4.0.2", "yoast/phpunit-polyfills": "^1.0.4" }, "suggest": { @@ -4423,14 +4423,15 @@ "ext-imap": "Needed to support advanced email address parsing according to RFC822", "ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses", "ext-openssl": "Needed for secure SMTP sending and DKIM signing", - "greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication", "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication", + "ipwsystems/oauth2-entraid-provider": "Needed for Microsoft Azure (Entra ID) XOAUTH2 authentication", "league/oauth2-google": "Needed for Google XOAUTH2 authentication", "psr/log": "For optional PSR-3 debug logging", "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)", "thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication" }, - "time": "2026-05-18T08:06:14+00:00", + "time": "2026-12-04T10:35:10+00:00", + "published-time": "2026-12-04T10:35:39+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -4462,7 +4463,7 @@ "description": "PHPMailer is a full-featured email creation and transfer class for PHP", "support": { "issues": "https://github.com/PHPMailer/PHPMailer/issues", - "source": "https://github.com/PHPMailer/PHPMailer/tree/v7.1.1" + "source": "https://github.com/PHPMailer/PHPMailer/tree/v7.4.1" }, "funding": [ { diff --git a/core/vendor/composer/installed.php b/core/vendor/composer/installed.php index 475f246381..d39a23ec4e 100644 --- a/core/vendor/composer/installed.php +++ b/core/vendor/composer/installed.php @@ -584,9 +584,9 @@ 'dev_requirement' => false, ), 'phpmailer/phpmailer' => array( - 'pretty_version' => 'v7.1.1', - 'version' => '7.1.1.0', - 'reference' => '1bc1716a507a65e039d4ac9d9adebbbd0d346e15', + 'pretty_version' => 'v7.4.1', + 'version' => '7.4.1.0', + 'reference' => '4ddb1d8485a4216f8a97beaf185361669c619dc2', 'type' => 'library', 'install_path' => __DIR__ . '/../phpmailer/phpmailer', 'aliases' => array(), diff --git a/core/vendor/phpmailer/phpmailer/README.md b/core/vendor/phpmailer/phpmailer/README.md index bf0421f241..f53f396a2e 100644 --- a/core/vendor/phpmailer/phpmailer/README.md +++ b/core/vendor/phpmailer/phpmailer/README.md @@ -27,7 +27,7 @@ - Protects against header injection attacks - Error messages in over 50 languages! - DKIM and S/MIME signing support -- Compatible with PHP 5.5 and later, including PHP 8.5 +- Compatible with PHP 5.5 and later, including PHP 8.6 - Namespaced to prevent name clashes - Much more! diff --git a/core/vendor/phpmailer/phpmailer/SECURITY.md b/core/vendor/phpmailer/phpmailer/SECURITY.md index 4f34026dfa..3bc94f08d3 100644 --- a/core/vendor/phpmailer/phpmailer/SECURITY.md +++ b/core/vendor/phpmailer/phpmailer/SECURITY.md @@ -2,6 +2,20 @@ Please disclose any security issues or vulnerabilities found through [Tidelift's coordinated disclosure system](https://tidelift.com/security) or to the maintainers privately. +In PHPMailer 6.10.0 — 7.3.0, SMTPUTF8 mode skipped the quoting applied to display names on other code paths, writing untrusted names into To/From/Cc/Bcc/Reply-To headers verbatim. If an email address contained UTF-8 characters, an accompanying user-supplied name containing `<`, `>` and `,` could append extra mailboxes to the header's address list. When sending by SMTP, these addresses are not used (though they would be visible to recipients), but in the mail, sendmail and qmail transports these became real delivery recipients, copying messages to additional user-supplied addresses. Recorded as [GHSA-wpxm-6j67-ccr4](https://github.com/PHPMailer/PHPMailer/security/advisories/GHSA-wpxm-6j67-ccr4). Reported by Priyank Nigam, Microsoft Security Engineering @priyankn. + +PHPMailer 7.3.0 and earlier fail to escape backslashes in attachment file names in addition to double quotes, closing the same quoted-string injection vector as CVE-2020-13625. A name like `a\"; filename=evil.exe` could inject a second `filename` parameter into `Content-Type`/`Content-Disposition` headers, bypassing attachment filters based on file name extensions; the attachments themselves are unaffected. Recorded as [GHSA-jqw7-rprw-3x24](https://github.com/PHPMailer/PHPMailer/security/advisories/GHSA-jqw7-rprw-3x24). Reported by @Humbertosp of [SVO](https://svo.com.br). + +PHPMailer 7.3.0 and earlier do not validate the `Priority` property, permitting header injection if the caller fails to validate priority values. Recorded as [GHSA-m63c-qqvj-57cp](https://github.com/PHPMailer/PHPMailer/security/advisories/GHSA-m63c-qqvj-57cp). Reported by [Fariskhi Vidyan](mailto:fvidyan@gmail.com). + +PHPMailer 7.3.0 and earlier do not validate the `type` parameter of attachments, permitting MIME sub-part header injection if the caller fails to validate type values. Impact is limited because it only applies to attachments, so can't inject message-level headers. Mitigated by applying `secureHeader()` to `$type` values. Recorded as [GHSA-6p6c-7gc2-3mpg](https://github.com/PHPMailer/PHPMailer/security/advisories/GHSA-6p6c-7gc2-3mpg). Reported by [N.Harsha Vardhan](mailto:saiharsha0546@gmail.com). + +PHPMailer 7.3.0 and earlier do not validate the `DKIM_selector`, `DKIM_domain`, and `DKIM_identity` properties, permitting header injection if the caller fails to validate their values. Mitigated by applying validation checks before the properties are used. Recorded as [GHSA-69mx-xjj2-3m35](https://github.com/PHPMailer/PHPMailer/security/advisories/GHSA-69mx-xjj2-3m35). Reported by [Fariskhi Vidyan](mailto:fvidyan@gmail.com). + +PHPMailer 7.3.0 and earlier will read any additional data in the input buffer after a TLS session is started with STARTTLS. This is a protocol contravention, but can result in the excess data appearing *inside* the TLS tunnel. After the fix, any data present at this point will cause the connection to be aborted. Recorded as [GHSA-48ww-9fvv-776g](https://github.com/PHPMailer/PHPMailer/security/advisories/GHSA-48ww-9fvv-776g). Reported by @markhutsefluts. + +In PHPMailer 5.2.14 – 7.3.0, punycoded IDN addresses malformed due to using a mismatched `CharSet` could allow attacker-provided addresses to be used for sending. Recorded as [GHSA-jr68-w5cp-4rp7](https://github.com/PHPMailer/PHPMailer/security/advisories/GHSA-jr68-w5cp-4rp7): Reported by Dickson Wu (SEAL & CertiK) @DicksonWu654. + PHPMailer 6.4.1 and earlier contain a vulnerability that can result in untrusted code being called (if such code is injected into the host project's scope by other means). If the `$patternselect` parameter to `validateAddress()` is set to `'php'` (the default, defined by `PHPMailer::$validator`), and the global namespace contains a function called `php`, it will be called in preference to the built-in validator of the same name. Mitigated in PHPMailer 6.5.0 by denying the use of simple strings as validator function names. Recorded as [CVE-2021-3603](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2021-3603). Reported by [Vikrant Singh Chauhan](mailto:vi@hackberry.xyz) via [huntr.dev](https://www.huntr.dev/). PHPMailer versions 6.4.1 and earlier contain a possible remote code execution vulnerability through the `$lang_path` parameter of the `setLanguage()` method. If the `$lang_path` parameter is passed unfiltered from user input, it can be set to [a UNC path](https://docs.microsoft.com/en-us/dotnet/standard/io/file-path-formats#unc-paths), and if an attacker is also able to persuade the server to load a file from that UNC path, a script file under their control may be executed. This vulnerability only applies to systems that resolve UNC paths, typically only Microsoft Windows. diff --git a/core/vendor/phpmailer/phpmailer/VERSION b/core/vendor/phpmailer/phpmailer/VERSION index 21c8c7b46b..815da58b7a 100644 --- a/core/vendor/phpmailer/phpmailer/VERSION +++ b/core/vendor/phpmailer/phpmailer/VERSION @@ -1 +1 @@ -7.1.1 +7.4.1 diff --git a/core/vendor/phpmailer/phpmailer/composer.json b/core/vendor/phpmailer/phpmailer/composer.json index 63d0ffd674..2e2798fb7b 100644 --- a/core/vendor/phpmailer/phpmailer/composer.json +++ b/core/vendor/phpmailer/phpmailer/composer.json @@ -1,7 +1,8 @@ { "name": "phpmailer/phpmailer", - "type": "library", "description": "PHPMailer is a full-featured email creation and transfer class for PHP", + "license": "LGPL-2.1-only", + "type": "library", "authors": [ { "name": "Marcus Bointon", @@ -21,16 +22,10 @@ ], "funding": [ { - "url": "https://github.com/Synchro", - "type": "github" + "type": "github", + "url": "https://github.com/Synchro" } ], - "config": { - "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": true - }, - "lock": false - }, "require": { "php": ">=5.5.0", "ext-ctype": "*", @@ -39,25 +34,25 @@ }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^1.0", - "doctrine/annotations": "^1.2.6 || ^1.13.3", + "doctrine/annotations": "^1.2.6", "php-parallel-lint/php-console-highlighter": "^1.0.0", "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^10.0.0@dev", - "squizlabs/php_codesniffer": "^3.13.5", + "squizlabs/php_codesniffer": "^3.13.6 || ^4.0.2", "yoast/phpunit-polyfills": "^1.0.4" }, "suggest": { - "decomplexity/SendOauth2": "Adapter for using XOAUTH2 authentication", "ext-imap": "Needed to support advanced email address parsing according to RFC822", "ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses", "ext-openssl": "Needed for secure SMTP sending and DKIM signing", - "greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication", + "decomplexity/SendOauth2": "Adapter for using XOAUTH2 authentication", + "directorytree/imapengine": "For uploading sent messages via IMAP, see gmail example", + "ipwsystems/oauth2-entraid-provider": "Needed for Microsoft Azure (Entra ID) XOAUTH2 authentication", "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication", "league/oauth2-google": "Needed for Google XOAUTH2 authentication", "psr/log": "For optional PSR-3 debug logging", "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)", - "thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication", - "directorytree/imapengine": "For uploading sent messages via IMAP, see gmail example" + "thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication" }, "minimum-stability": "dev", "prefer-stable": true, @@ -71,14 +66,19 @@ "PHPMailer\\Test\\": "test/" } }, - "license": "LGPL-2.1-only", + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + }, + "lock": false + }, "scripts": { "check": "./vendor/bin/phpcs", "style": "./vendor/bin/phpcbf", "test": "./vendor/bin/phpunit --no-coverage", "coverage": "./vendor/bin/phpunit", "lint": [ - "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . --show-deprecated -e php,phps --exclude vendor --exclude .git --exclude build" + "@php -r \"passthru(escapeshellarg(PHP_BINARY) . ' ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint -p ' . escapeshellarg(escapeshellarg(PHP_BINARY)) . ' . --show-deprecated -e php,phps --exclude vendor --exclude .git --exclude build ' . implode(' ', array_map('escapeshellarg', array_slice(\\$argv, 1))), \\$code); exit(\\$code);\" --" ] } } diff --git a/core/vendor/phpmailer/phpmailer/get_oauth_token.php b/core/vendor/phpmailer/phpmailer/get_oauth_token.php index 9342b9c757..ecb65440ef 100644 --- a/core/vendor/phpmailer/phpmailer/get_oauth_token.php +++ b/core/vendor/phpmailer/phpmailer/get_oauth_token.php @@ -44,8 +44,8 @@ use Hayageek\OAuth2\Client\Provider\Yahoo; //@see https://github.com/stevenmaguire/oauth2-microsoft use Stevenmaguire\OAuth2\Client\Provider\Microsoft; -//@see https://github.com/greew/oauth2-azure-provider -use Greew\OAuth2\Client\Provider\Azure; +//@see https://packagist.org/packages/ipwsystems/oauth2-entraid-provider +use IpwSystems\OAuth2\Client\Provider\EntraID; if (!isset($_GET['code']) && !isset($_POST['provider'])) { ?> @@ -60,7 +60,7 @@
-
+

Enter id and secret

These details are obtained by setting up an app in your provider's developer console.

@@ -142,7 +142,7 @@ case 'Azure': $params['tenantId'] = $tenantId; - $provider = new Azure($params); + $provider = new EntraID($params); $options = [ 'scope' => [ 'https://outlook.office.com/SMTP.Send', @@ -160,15 +160,24 @@ //If we don't have an authorization code then get one $authUrl = $provider->getAuthorizationUrl($options); $_SESSION['oauth2state'] = $provider->getState(); + //Providers that use PKCE need the code verifier again when the code is redeemed + //getPkceCode() needs league/oauth2-client 2.7.0 or later + $_SESSION['oauth2pkce'] = method_exists($provider, 'getPkceCode') ? $provider->getPkceCode() : null; header('Location: ' . $authUrl); exit; //Check given state against previously stored one to mitigate CSRF attack } elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) { unset($_SESSION['oauth2state']); + unset($_SESSION['oauth2pkce']); unset($_SESSION['provider']); exit('Invalid state'); } else { unset($_SESSION['provider']); + //Restore the PKCE code verifier before redeeming the code (no effect for providers without PKCE) + if (method_exists($provider, 'setPkceCode')) { + $provider->setPkceCode(isset($_SESSION['oauth2pkce']) ? $_SESSION['oauth2pkce'] : null); + } + unset($_SESSION['oauth2pkce']); //Try to get an access token (using the authorization code grant) $token = $provider->getAccessToken( 'authorization_code', diff --git a/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ca.php b/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ca.php index 34684855a5..0f15821252 100644 --- a/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ca.php +++ b/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-ca.php @@ -24,4 +24,14 @@ $PHPMAILER_LANG['smtp_connect_failed'] = 'Ha fallat el SMTP Connect().'; $PHPMAILER_LANG['smtp_error'] = 'Error del servidor SMTP: '; $PHPMAILER_LANG['variable_set'] = 'No s’ha pogut establir o restablir la variable: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; +$PHPMAILER_LANG['extension_missing'] = 'Falta l’extensió: '; +$PHPMAILER_LANG['buggy_php'] = 'La teva versió de PHP té un error que pot fer que els missatges arribin malmesos. Per evitar-ho, envia per SMTP, desactiva l’opció mail.add_x_header al php.ini, canvia a macOS o Linux, o actualitza PHP a la versió 7.0.17+ o 7.1.3+.'; +$PHPMAILER_LANG['invalid_header'] = 'Nom o valor de capçalera no vàlid'; +$PHPMAILER_LANG['invalid_hostentry'] = 'Entrada de host no vàlida: '; +$PHPMAILER_LANG['invalid_host'] = 'Host no vàlid: '; +$PHPMAILER_LANG['smtp_code'] = 'Codi SMTP: '; +$PHPMAILER_LANG['smtp_code_ex'] = 'Informació SMTP addicional: '; +$PHPMAILER_LANG['smtp_detail'] = 'Detall: '; +$PHPMAILER_LANG['no_smtputf8'] = 'El servidor no admet SMTPUTF8, necessari per enviar a adreces Unicode.'; +$PHPMAILER_LANG['imap_recommended'] = 'No es recomana fer servir l’analitzador d’adreces simplificat. Instal·la l’extensió IMAP de PHP per a una anàlisi RFC822 completa.'; +$PHPMAILER_LANG['deprecated_argument'] = 'Argument obsolet: '; diff --git a/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-de.php b/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-de.php index e7e59d2b67..335a40fdb7 100644 --- a/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-de.php +++ b/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-de.php @@ -26,3 +26,11 @@ $PHPMAILER_LANG['smtp_error'] = 'Fehler vom SMTP-Server: '; $PHPMAILER_LANG['variable_set'] = 'Kann Variable nicht setzen oder zurücksetzen: '; $PHPMAILER_LANG['extension_missing'] = 'Fehlende Erweiterung: '; +$PHPMAILER_LANG['buggy_php'] = 'Ihre PHP-Version ist von einem Fehler betroffen, der zu beschädigten Nachrichten führen kann. Um ihn zu umgehen, versenden Sie über SMTP, deaktivieren Sie die Option mail.add_x_header in Ihrer php.ini, wechseln Sie zu macOS oder Linux oder aktualisieren Sie PHP auf Version 7.0.17+ oder 7.1.3+.'; +$PHPMAILER_LANG['invalid_header'] = 'Ungültiger Header-Name oder -Wert'; +$PHPMAILER_LANG['smtp_code'] = 'SMTP-Code: '; +$PHPMAILER_LANG['smtp_code_ex'] = 'Zusätzliche SMTP-Informationen: '; +$PHPMAILER_LANG['smtp_detail'] = 'Detail: '; +$PHPMAILER_LANG['no_smtputf8'] = 'Der Server unterstützt kein SMTPUTF8, das für den Versand an Unicode-Adressen erforderlich ist.'; +$PHPMAILER_LANG['imap_recommended'] = 'Die Verwendung des vereinfachten Adressparsers wird nicht empfohlen. Installieren Sie die IMAP-Erweiterung von PHP für eine vollständige RFC822-Analyse.'; +$PHPMAILER_LANG['deprecated_argument'] = 'Veraltetes Argument: '; diff --git a/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-es.php b/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-es.php index e6a3d85ef6..e6d9943c78 100644 --- a/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-es.php +++ b/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-es.php @@ -36,3 +36,4 @@ $PHPMAILER_LANG['variable_set'] = 'No se pudo configurar la variable: '; $PHPMAILER_LANG['imap_recommended'] = 'No se recomienda usar el analizador de direcciones simplificado. Instala la extensión IMAP de PHP para un análisis RFC822 más completo.'; $PHPMAILER_LANG['deprecated_argument'] = 'Argumento obsoleto: '; +$PHPMAILER_LANG['no_smtputf8'] = 'El servidor no admite SMTPUTF8, necesario para enviar a direcciones Unicode.'; diff --git a/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-et.php b/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-et.php index 93addc9e33..96d04086aa 100644 --- a/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-et.php +++ b/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-et.php @@ -11,7 +11,7 @@ $PHPMAILER_LANG['connect_host'] = 'SMTP Viga: Ei õnnestunud luua ühendust SMTP serveriga.'; $PHPMAILER_LANG['data_not_accepted'] = 'SMTP Viga: Vigased andmed.'; $PHPMAILER_LANG['empty_message'] = 'Tühi kirja sisu'; -$PHPMAILER_LANG["encoding"] = 'Tundmatu kodeering: '; +$PHPMAILER_LANG['encoding'] = 'Tundmatu kodeering: '; $PHPMAILER_LANG['execute'] = 'Tegevus ebaõnnestus: '; $PHPMAILER_LANG['file_access'] = 'Pole piisavalt õiguseid järgneva faili avamiseks: '; $PHPMAILER_LANG['file_open'] = 'Faili Viga: Faili avamine ebaõnnestus: '; @@ -21,7 +21,7 @@ $PHPMAILER_LANG['provide_address'] = 'Te peate määrama vähemalt ühe saaja e-posti aadressi.'; $PHPMAILER_LANG['mailer_not_supported'] = ' maileri tugi puudub.'; $PHPMAILER_LANG['recipients_failed'] = 'SMTP Viga: Järgnevate saajate e-posti aadressid on vigased: '; -$PHPMAILER_LANG["signing"] = 'Viga allkirjastamisel: '; +$PHPMAILER_LANG['signing'] = 'Viga allkirjastamisel: '; $PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() ebaõnnestus.'; $PHPMAILER_LANG['smtp_error'] = 'SMTP serveri viga: '; $PHPMAILER_LANG['variable_set'] = 'Ei õnnestunud määrata või lähtestada muutujat: '; diff --git a/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-fr.php b/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-fr.php index a6d582d833..128a26f668 100644 --- a/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-fr.php +++ b/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-fr.php @@ -34,3 +34,6 @@ $PHPMAILER_LANG['smtp_detail'] = 'Détails : '; $PHPMAILER_LANG['smtp_error'] = 'Erreur du serveur SMTP : '; $PHPMAILER_LANG['variable_set'] = 'Impossible d’initialiser ou de réinitialiser une variable : '; +$PHPMAILER_LANG['imap_recommended'] = 'Il n’est pas recommandé d’utiliser l’analyseur d’adresses simplifié. Installez l’extension IMAP de PHP pour une analyse RFC822 plus complète.'; +$PHPMAILER_LANG['deprecated_argument'] = 'Argument obsolète : '; +$PHPMAILER_LANG['no_smtputf8'] = 'Le serveur ne prend pas en charge SMTPUTF8, nécessaire pour l’envoi à des adresses Unicode.'; diff --git a/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-it.php b/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-it.php index 08a6b73331..1453d0b906 100644 --- a/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-it.php +++ b/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-it.php @@ -26,3 +26,13 @@ $PHPMAILER_LANG['smtp_error'] = 'Errore del server SMTP: '; $PHPMAILER_LANG['variable_set'] = 'Impossibile impostare o resettare la variabile: '; $PHPMAILER_LANG['extension_missing'] = 'Estensione mancante: '; +$PHPMAILER_LANG['buggy_php'] = 'La tua versione di PHP è affetta da un bug che può causare messaggi corrotti. Per risolvere, invia tramite SMTP, disattiva l’opzione mail.add_x_header nel tuo php.ini, passa a macOS o Linux, oppure aggiorna PHP alla versione 7.0.17+ o 7.1.3+.'; +$PHPMAILER_LANG['invalid_header'] = 'Nome o valore dell’intestazione non valido'; +$PHPMAILER_LANG['invalid_hostentry'] = 'Voce host non valida: '; +$PHPMAILER_LANG['invalid_host'] = 'Host non valido: '; +$PHPMAILER_LANG['smtp_code'] = 'Codice SMTP: '; +$PHPMAILER_LANG['smtp_code_ex'] = 'Informazioni SMTP aggiuntive: '; +$PHPMAILER_LANG['smtp_detail'] = 'Dettaglio: '; +$PHPMAILER_LANG['no_smtputf8'] = 'Il server non supporta SMTPUTF8, necessario per inviare a indirizzi Unicode.'; +$PHPMAILER_LANG['imap_recommended'] = 'L’uso del parser di indirizzi semplificato non è consigliato. Installa l’estensione IMAP di PHP per un’analisi RFC822 completa.'; +$PHPMAILER_LANG['deprecated_argument'] = 'Argomento deprecato: '; diff --git a/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-kk.php b/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-kk.php new file mode 100644 index 0000000000..f684fa93cd --- /dev/null +++ b/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-kk.php @@ -0,0 +1,37 @@ + + */ + +$PHPMAILER_LANG['authenticate'] = 'SMTP қатесі: аутентификациядан өту мүмкін емес.'; +$PHPMAILER_LANG['buggy_php'] = 'Сіздің PHP нұсқаңызда хабарламалардың бүлінуіне әкелуі мүмкін қате бар. Түзету үшін SMTP арқылы жіберуге ауысыңыз, php.ini файлындағы mail.add_x_header опциясын өшіріңіз, MacOS немесе Linux-ке ауысыңыз немесе PHP-ті 7.0.17+ немесе 7.1.3+ нұсқасына жаңартыңыз.'; +$PHPMAILER_LANG['connect_host'] = 'SMTP қатесі: SMTP серверіне қосылу мүмкін емес.'; +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP қатесі: деректер қабылданбады.'; +$PHPMAILER_LANG['empty_message'] = 'Бос хабарлама.'; +$PHPMAILER_LANG['encoding'] = 'Белгісіз кодтау: '; +$PHPMAILER_LANG['execute'] = 'Пәрменді орындау мүмкін емес: '; +$PHPMAILER_LANG['extension_missing'] = 'Кеңейтім жоқ: '; +$PHPMAILER_LANG['file_access'] = 'Файлға қол жеткізу мүмкін емес: '; +$PHPMAILER_LANG['file_open'] = 'Файл қатесі: файлды ашу мүмкін емес: '; +$PHPMAILER_LANG['from_failed'] = 'Жіберушінің мекенжайы дұрыс емес: '; +$PHPMAILER_LANG['instantiate'] = 'mail() функциясын іске қосу мүмкін емес.'; +$PHPMAILER_LANG['invalid_address'] = 'Электрондық пошта мекенжайының пішімі қате болғандықтан жіберілмеді: '; +$PHPMAILER_LANG['invalid_header'] = 'Тақырып атауы немесе мәні жарамсыз.'; +$PHPMAILER_LANG['invalid_hostentry'] = 'Хост жазбасы дұрыс емес: '; +$PHPMAILER_LANG['invalid_host'] = 'Дұрыс емес хост: '; +$PHPMAILER_LANG['mailer_not_supported'] = ' пошта серверіне қолдау көрсетілмейді.'; +$PHPMAILER_LANG['provide_address'] = 'Сіз алушының кем дегенде бір электрондық пошта мекенжайын көрсетуіңіз керек.'; +$PHPMAILER_LANG['recipients_failed'] = 'SMTP қатесі: келесі алушыларға жіберу мүмкін болмады: '; +$PHPMAILER_LANG['signing'] = 'Қолтаңба қатесі: '; +$PHPMAILER_LANG['smtp_code'] = 'SMTP коды: '; +$PHPMAILER_LANG['smtp_code_ex'] = 'SMTP қосымша ақпараты: '; +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP серверіне қосылу қатесі.'; +$PHPMAILER_LANG['smtp_detail'] = 'Мәліметтер: '; +$PHPMAILER_LANG['smtp_error'] = 'SMTP серверінің қатесі: '; +$PHPMAILER_LANG['variable_set'] = 'Айнымалыны орнату немесе бастапқы күйге келтіру мүмкін емес: '; +$PHPMAILER_LANG['no_smtputf8'] = 'Сервер Unicode мекенжайларына хат жіберу үшін қажетті SMTPUTF8 протоколын қолдамайды.'; +$PHPMAILER_LANG['imap_recommended'] = 'Мекенжайларды талдаудың жеңілдетілген құралын пайдалану ұсынылмайды. ' . 'RFC822 стандартына сай толық талдау жүргізу үшін PHP IMAP кеңейтімін орнатыңыз.'; +$PHPMAILER_LANG['deprecated_argument'] = 'Ескірген аргумент: '; diff --git a/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-nb.php b/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-nb.php index 621d2e74f5..cc4812f06e 100644 --- a/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-nb.php +++ b/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-nb.php @@ -4,34 +4,35 @@ * Norwegian Bokmål PHPMailer language file: refer to English translation for definitive list * @package PHPMailer * @author Wera AS + * @author Adrian Thomassen */ - $PHPMAILER_LANG['authenticate'] = 'SMTP-feil: Kunne ikke autentisere.'; - $PHPMAILER_LANG['buggy_php'] = 'Din versjon av PHP er påvirket av en feil som kan føre til ødelagte meldinger. For å løse problemet kan du bytte til sending via SMTP, deaktivere mail.add_x_header-alternativet i php.ini, bytte til MacOS eller Linux, eller oppgradere PHP til versjon 7.0.17+ eller 7.1.3+.'; - $PHPMAILER_LANG['connect_host'] = 'SMTP-feil: Kunne ikke koble til SMTP-vert.'; - $PHPMAILER_LANG['data_not_accepted'] = 'SMTP-feil: data ikke akseptert.'; - $PHPMAILER_LANG['empty_message'] = 'Meldingsinnholdet er tomt'; - $PHPMAILER_LANG['encoding'] = 'Ukjent koding: '; - $PHPMAILER_LANG['execute'] = 'Kunne ikke utføres: '; - $PHPMAILER_LANG['extension_missing'] = 'Utvidelse mangler: '; - $PHPMAILER_LANG['file_access'] = 'Kunne ikke få tilgang til filen: '; - $PHPMAILER_LANG['file_open'] = 'Feil i fil: Kunne ikke åpne filen: '; - $PHPMAILER_LANG['from_failed'] = 'Følgende avsenderadresse mislyktes: '; - $PHPMAILER_LANG['instantiate'] = 'Kunne ikke starte e-postfunksjonen.'; - $PHPMAILER_LANG['invalid_address'] = 'Ugyldig adresse: '; - $PHPMAILER_LANG['invalid_header'] = 'Ugyldig headernavn eller verdi'; - $PHPMAILER_LANG['invalid_hostentry'] = 'Ugyldig vertsinngang: '; - $PHPMAILER_LANG['invalid_host'] = 'Ugyldig vert: '; - $PHPMAILER_LANG['mailer_not_supported'] = ' sender er ikke støttet.'; - $PHPMAILER_LANG['provide_address'] = 'Du må oppgi minst én mottaker-e-postadresse.'; - $PHPMAILER_LANG['recipients_failed'] = 'SMTP-feil: Følgende mottakeradresser feilet: '; - $PHPMAILER_LANG['signing'] = 'Signeringsfeil: '; - $PHPMAILER_LANG['smtp_code'] = 'SMTP-kode: '; - $PHPMAILER_LANG['smtp_code_ex'] = 'Ytterligere SMTP-info: '; - $PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP connect() mislyktes.'; - $PHPMAILER_LANG['smtp_detail'] = 'Detaljer: '; - $PHPMAILER_LANG['smtp_error'] = 'SMTP-serverfeil: '; - $PHPMAILER_LANG['variable_set'] = 'Kan ikke angi eller tilbakestille variabel: '; - $PHPMAILER_LANG['no_smtputf8'] = 'Serveren støtter ikke SMTPUTF8, som er nødvendig for å sende til Unicode-adresser.'; - $PHPMAILER_LANG['imap_recommended'] = 'Det anbefales ikke å bruke forenklet adresseanalyse. Installer PHP IMAP-utvidelsen for full RFC822-analyse.'; - $PHPMAILER_LANG['deprecated_argument'] = 'Avviklet argument: '; +$PHPMAILER_LANG['authenticate'] = 'SMTP-feil: Kunne ikke autentisere.'; +$PHPMAILER_LANG['buggy_php'] = 'Din versjon av PHP er påvirket av en feil som kan føre til ødelagte meldinger. For å løse problemet kan du bytte til sending via SMTP, deaktivere mail.add_x_header-alternativet i php.ini, bytte til macOS eller Linux, eller oppgradere PHP til versjon 7.0.17+ eller 7.1.3+.'; +$PHPMAILER_LANG['connect_host'] = 'SMTP-feil: Kunne ikke koble til SMTP-vert.'; +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP-feil: data ikke akseptert.'; +$PHPMAILER_LANG['empty_message'] = 'Meldingsinnholdet er tomt'; +$PHPMAILER_LANG['encoding'] = 'Ukjent koding: '; +$PHPMAILER_LANG['execute'] = 'Kunne ikke utføre: '; +$PHPMAILER_LANG['extension_missing'] = 'Utvidelse mangler: '; +$PHPMAILER_LANG['file_access'] = 'Kunne ikke få tilgang til filen: '; +$PHPMAILER_LANG['file_open'] = 'Feil i fil: Kunne ikke åpne filen: '; +$PHPMAILER_LANG['from_failed'] = 'Følgende avsenderadresse mislyktes: '; +$PHPMAILER_LANG['instantiate'] = 'Kunne ikke starte e-postfunksjonen.'; +$PHPMAILER_LANG['invalid_address'] = 'Ugyldig adresse: '; +$PHPMAILER_LANG['invalid_header'] = 'Ugyldig headernavn eller verdi'; +$PHPMAILER_LANG['invalid_hostentry'] = 'Ugyldig vertsoppføring: '; +$PHPMAILER_LANG['invalid_host'] = 'Ugyldig vert: '; +$PHPMAILER_LANG['mailer_not_supported'] = ' sender er ikke støttet.'; +$PHPMAILER_LANG['provide_address'] = 'Du må oppgi minst én mottaker-e-postadresse.'; +$PHPMAILER_LANG['recipients_failed'] = 'SMTP-feil: Følgende mottakeradresser mislyktes: '; +$PHPMAILER_LANG['signing'] = 'Signeringsfeil: '; +$PHPMAILER_LANG['smtp_code'] = 'SMTP-kode: '; +$PHPMAILER_LANG['smtp_code_ex'] = 'Ytterligere SMTP-info: '; +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP connect() mislyktes.'; +$PHPMAILER_LANG['smtp_detail'] = 'Detaljer: '; +$PHPMAILER_LANG['smtp_error'] = 'SMTP-serverfeil: '; +$PHPMAILER_LANG['variable_set'] = 'Kan ikke angi eller tilbakestille variabel: '; +$PHPMAILER_LANG['no_smtputf8'] = 'Serveren støtter ikke SMTPUTF8, som er nødvendig for å sende til Unicode-adresser'; +$PHPMAILER_LANG['imap_recommended'] = 'Det anbefales ikke å bruke forenklet adresseanalyse. Installer PHP IMAP-utvidelsen for full RFC822-analyse.'; +$PHPMAILER_LANG['deprecated_argument'] = 'Avviklet argument: '; diff --git a/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-pt.php b/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-pt.php index 79a6802679..ca2015afbe 100644 --- a/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-pt.php +++ b/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-pt.php @@ -32,3 +32,6 @@ $PHPMAILER_LANG['smtp_detail'] = 'Detalhes: '; $PHPMAILER_LANG['smtp_error'] = 'Erro do servidor SMTP: '; $PHPMAILER_LANG['variable_set'] = 'Não foi possível definir ou redefinir a variável: '; +$PHPMAILER_LANG['no_smtputf8'] = 'O servidor não suporta SMTPUTF8, necessário para enviar para endereços Unicode.'; +$PHPMAILER_LANG['imap_recommended'] = 'Não é recomendado utilizar o analisador de endereços simplificado. Instale a extensão IMAP do PHP para uma análise RFC822 completa.'; +$PHPMAILER_LANG['deprecated_argument'] = 'Argumento obsoleto: '; diff --git a/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-pt_br.php b/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-pt_br.php index 5239865a6f..36f2529528 100644 --- a/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-pt_br.php +++ b/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-pt_br.php @@ -36,3 +36,6 @@ $PHPMAILER_LANG['smtp_code_ex'] = 'Informações adicionais do servidor SMTP: '; $PHPMAILER_LANG['smtp_detail'] = 'Detalhes do servidor SMTP: '; $PHPMAILER_LANG['variable_set'] = 'Não foi possível definir ou redefinir a variável: '; +$PHPMAILER_LANG['no_smtputf8'] = 'O servidor não suporta SMTPUTF8, necessário para enviar para endereços Unicode.'; +$PHPMAILER_LANG['imap_recommended'] = 'Não é recomendado usar o analisador de endereços simplificado. Instale a extensão IMAP do PHP para uma análise RFC822 completa.'; +$PHPMAILER_LANG['deprecated_argument'] = 'Argumento obsoleto: '; diff --git a/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-sv.php b/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-sv.php index 9872c19219..2a72ebe02f 100644 --- a/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-sv.php +++ b/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-sv.php @@ -9,7 +9,7 @@ $PHPMAILER_LANG['authenticate'] = 'SMTP fel: Kunde inte autentisera.'; $PHPMAILER_LANG['connect_host'] = 'SMTP fel: Kunde inte ansluta till SMTP-server.'; $PHPMAILER_LANG['data_not_accepted'] = 'SMTP fel: Data accepterades inte.'; -//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; +$PHPMAILER_LANG['empty_message'] = 'Meddelandet är tomt'; $PHPMAILER_LANG['encoding'] = 'Okänt encode-format: '; $PHPMAILER_LANG['execute'] = 'Kunde inte köra: '; $PHPMAILER_LANG['file_access'] = 'Ingen åtkomst till fil: '; @@ -25,3 +25,13 @@ $PHPMAILER_LANG['smtp_error'] = 'SMTP serverfel: '; $PHPMAILER_LANG['variable_set'] = 'Kunde inte definiera eller återställa variabel: '; $PHPMAILER_LANG['extension_missing'] = 'Tillägg ej tillgängligt: '; +$PHPMAILER_LANG['buggy_php'] = 'Din PHP-version har en bugg som kan ge skadade meddelanden. Åtgärda det genom att skicka via SMTP, stänga av inställningen mail.add_x_header i din php.ini, byta till macOS eller Linux, eller uppgradera PHP till version 7.0.17+ eller 7.1.3+.'; +$PHPMAILER_LANG['invalid_header'] = 'Ogiltigt namn eller värde på rubrikfält'; +$PHPMAILER_LANG['invalid_hostentry'] = 'Ogiltig värdpost: '; +$PHPMAILER_LANG['invalid_host'] = 'Ogiltig värd: '; +$PHPMAILER_LANG['smtp_code'] = 'SMTP-kod: '; +$PHPMAILER_LANG['smtp_code_ex'] = 'Ytterligare SMTP-information: '; +$PHPMAILER_LANG['smtp_detail'] = 'Detalj: '; +$PHPMAILER_LANG['no_smtputf8'] = 'Servern stöder inte SMTPUTF8, som krävs för att skicka till Unicode-adresser.'; +$PHPMAILER_LANG['imap_recommended'] = 'Den förenklade adresstolken rekommenderas inte. Installera PHP:s IMAP-tillägg för fullständig RFC822-tolkning.'; +$PHPMAILER_LANG['deprecated_argument'] = 'Föråldrat argument: '; diff --git a/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-tr.php b/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-tr.php index ab5550168f..b2858f3ec5 100644 --- a/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-tr.php +++ b/core/vendor/phpmailer/phpmailer/language/phpmailer.lang-tr.php @@ -38,6 +38,5 @@ $PHPMAILER_LANG['smtp_error'] = 'SMTP sunucu hatası: '; $PHPMAILER_LANG['variable_set'] = 'Değişken ayarlanamadı ya da sıfırlanamadı: '; $PHPMAILER_LANG['no_smtputf8'] = 'Unicode adreslere gönderim için gereken SMTPUTF8 desteği sunucu tarafından desteklenmiyor.'; -$PHPMAILER_LANG['imap_recommended'] = 'Basitleştirilmiş adres ayrıştırıcısını kullanmanız önerilmez. ' . - 'Tam RFC822 ayrıştırma için PHP IMAP eklentisini yükleyin.'; +$PHPMAILER_LANG['imap_recommended'] = 'Basitleştirilmiş adres ayrıştırıcısını kullanmanız önerilmez. Tam RFC822 ayrıştırma için PHP IMAP eklentisini yükleyin.'; $PHPMAILER_LANG['deprecated_argument'] = 'Kullanımdan kaldırılmış argüman: '; diff --git a/core/vendor/phpmailer/phpmailer/src/DSNConfigurator.php b/core/vendor/phpmailer/phpmailer/src/DSNConfigurator.php index 7058c1f05e..4a3502daa4 100644 --- a/core/vendor/phpmailer/phpmailer/src/DSNConfigurator.php +++ b/core/vendor/phpmailer/phpmailer/src/DSNConfigurator.php @@ -22,7 +22,10 @@ namespace PHPMailer\PHPMailer; /** - * Configure PHPMailer with DSN string. + * Configure PHPMailer with a DSN string. + * Be aware that a DSN string can configure *all* PHPMailer properties, + * including those that have security consequences, so do not use + * user-provided DSN strings without strict validation of all parameters. * * @see https://en.wikipedia.org/wiki/Data_source_name * @@ -51,6 +54,9 @@ public static function mailer($dsn, $exceptions = null) /** * Configure PHPMailer instance with DSN string. + * Warning: *all* PHPMailer properties can be set through this mechanism, + * including those that have security consequences, so do not use + * user-provided DSN strings without strict validation of all parameters. * * @param PHPMailer $mailer PHPMailer instance * @param string $dsn DSN @@ -140,7 +146,7 @@ private function configureSMTP($mailer, $config) $isSMTPS = 'smtps' === $config['scheme']; if ($isSMTPS) { - $mailer->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; + $mailer->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; } $mailer->Host = $config['host']; @@ -154,11 +160,11 @@ private function configureSMTP($mailer, $config) $mailer->SMTPAuth = isset($config['user']) || isset($config['pass']); if (isset($config['user'])) { - $mailer->Username = $config['user']; + $mailer->Username = rawurldecode($config['user']); } if (isset($config['pass'])) { - $mailer->Password = $config['pass']; + $mailer->Password = rawurldecode($config['pass']); } } @@ -168,7 +174,7 @@ private function configureSMTP($mailer, $config) * @param PHPMailer $mailer PHPMailer instance * @param array $options Options * - * @throws Exception If option is unknown + * @throws Exception If option is unknown, or a boolean option has an invalid value */ private function configureOptions(PHPMailer $mailer, $options) { @@ -203,7 +209,19 @@ private function configureOptions(PHPMailer $mailer, $options) case 'UseSendmailOptions': case 'do_verp': case 'DKIM_copyHeaderFields': - $mailer->$key = (bool) $value; + $boolean = filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); + if (null === $boolean) { + //Don't guess: a typo such as "ture" would otherwise silently become false + throw new Exception( + sprintf( + 'Invalid value for option "%s": "%s". Allowed values: "true", "false", "on", ' . + '"off", "yes", "no", "1", "0"', + $key, + $value + ) + ); + } + $mailer->$key = $boolean; break; case 'Priority': case 'SMTPDebug': diff --git a/core/vendor/phpmailer/phpmailer/src/OAuth.php b/core/vendor/phpmailer/phpmailer/src/OAuth.php index a7e958860c..2b80488fc3 100644 --- a/core/vendor/phpmailer/phpmailer/src/OAuth.php +++ b/core/vendor/phpmailer/phpmailer/src/OAuth.php @@ -123,9 +123,14 @@ protected function getToken() */ public function getOauth64() { - //Get a new token if it's not available or has expired + //Get a new token if it's not available or has expired. Update the refresh token. if (null === $this->oauthToken || $this->oauthToken->hasExpired()) { $this->oauthToken = $this->getToken(); + //Providers may not issue a new refresh token, in which case the current one remains valid + $refreshToken = $this->oauthToken->getRefreshToken(); + if (!empty($refreshToken)) { + $this->oauthRefreshToken = $refreshToken; + } } return base64_encode( @@ -136,4 +141,13 @@ public function getOauth64() "\001\001" ); } + /** + * Getter for the Refresh Token. + * + * @return string + */ + public function getRefreshToken() + { + return $this->oauthRefreshToken; + } } diff --git a/core/vendor/phpmailer/phpmailer/src/PHPMailer.php b/core/vendor/phpmailer/phpmailer/src/PHPMailer.php index 4900cbc43a..84ad844eab 100644 --- a/core/vendor/phpmailer/phpmailer/src/PHPMailer.php +++ b/core/vendor/phpmailer/phpmailer/src/PHPMailer.php @@ -62,8 +62,18 @@ class PHPMailer const RFC822_DATE_FORMAT = 'D, j M Y H:i:s O'; /** - * Email priority. - * Options: null (default), 1 = High, 3 = Normal, 5 = low. + * RFC 5322 atext characters, plus space and quoting characters. + * + * @var string + */ + const PHRASE_ATOM_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&\'*+/=?^_`{|}~ -'; + + /** + * Message priority. + * This is mapped to the non-standard X-Priority header. + * @see https://learn.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcmail/2bb19f1b-b35e-4966-b1cb-1afd044e83ab + * Options: null (default), integer 1–5 where 1 = Highest, 3 = Normal, 5 = lowest. + * Any other value will result in the header being omitted. * When null, the header is not set at all. * * @var int|null @@ -150,10 +160,10 @@ class PHPMailer /** * An iCal message part body. - * Only supported in simple alt or alt_inline message types - * To generate iCal event structures, use classes like EasyPeasyICS or iCalcreator. + * Only included in messages that have an AltBody. + * To generate iCal event structures, use a library such as spatie/icalendar-generator. * - * @see https://kigkonsult.se/iCalcreator/ + * @see https://github.com/spatie/icalendar-generator * * @var string */ @@ -400,7 +410,7 @@ class PHPMailer * @see SMTP::DEBUG_CLIENT: Client messages * @see SMTP::DEBUG_SERVER: Client and server messages * @see SMTP::DEBUG_CONNECTION: As SERVER plus connection status - * @see SMTP::DEBUG_LOWLEVEL: Noisy, low-level data output, rarely needed + * @see SMTP::DEBUG_LOWLEVEL: Noisy, low-level data output, includes unredacted credentials, rarely needed * * @see SMTP::$do_debug * @@ -769,7 +779,7 @@ class PHPMailer * * @var string */ - const VERSION = '7.1.1'; + const VERSION = '7.4.1'; /** * Error severity: message only, continue processing. @@ -803,6 +813,14 @@ class PHPMailer */ const FWS = ' '; + /** + * The character list trimmed by default. + * This matches the default charlist of trim(), rtrim(), and ltrim() + * before PHP 8.6, which added the form feed character (\f) to it. + * Passing this explicitly keeps behavior consistent across PHP versions. + */ + const TRIM_CHARACTERS = " \n\r\t\v\x00"; + /** * SMTP RFC standard line ending; Carriage Return, Line Feed. * @@ -952,8 +970,9 @@ protected function edebug($str) str_replace( "\n", "\n \t ", - trim($str) - ) + trim($str, self::TRIM_CHARACTERS) + ), + self::TRIM_CHARACTERS ), "\n"; } @@ -998,7 +1017,7 @@ public function isMail() */ private function parseSendmailPath($sendmailPath) { - $sendmailPath = trim((string)$sendmailPath); + $sendmailPath = trim((string)$sendmailPath, self::TRIM_CHARACTERS); if ($sendmailPath === '') { return $sendmailPath; } @@ -1143,7 +1162,7 @@ protected function addOrEnqueueAnAddress($kind, $address, $name) { $pos = false; if ($address !== null) { - $address = trim($address); + $address = trim($address, self::TRIM_CHARACTERS); $pos = strrpos($address, '@'); } if (false === $pos) { @@ -1163,7 +1182,7 @@ protected function addOrEnqueueAnAddress($kind, $address, $name) return false; } if ($name !== null && is_string($name)) { - $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim + $name = trim(preg_replace('/[\r\n]+/', '', $name), self::TRIM_CHARACTERS); //Strip breaks and trim } else { $name = ''; } @@ -1288,7 +1307,8 @@ protected function addAnAddress($kind, $address, $name = '') * the deprecated $useimap argument is truthy. * Note that quotes in the name part are removed. * - * @see https://www.andrew.cmu.edu/user/agreen1/testing/mrbs/web/Mail/RFC822.php A more careful implementation + * @deprecated This method will be removed in the next major release of PHPMailer. + * @see https://github.com/pear/Mail/blob/master/Mail/RFC822.php A more careful implementation * * @param string $addrstr The address list string * @param bool|null $useimap Deprecated in PHPMailer 6.11.0. @@ -1300,11 +1320,11 @@ protected function addAnAddress($kind, $address, $name = '') */ public static function parseAddresses($addrstr, $useimap = null, $charset = self::CHARSET_ISO88591) { - if ($useimap == true) { + if ($useimap) { trigger_error(self::lang('deprecated_argument') . '$useimap', E_USER_DEPRECATED); } $addresses = []; - if ($useimap == true && function_exists('imap_rfc822_parse_adrlist')) { + if ($useimap !== false && function_exists('imap_rfc822_parse_adrlist')) { //Use this built-in parser if it's available // phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.imap_rfc822_parse_adrlistRemoved -- wrapped in function_exists() $list = imap_rfc822_parse_adrlist($addrstr, ''); @@ -1342,7 +1362,7 @@ public static function parseAddresses($addrstr, $useimap = null, $charset = self /** * Parse a string containing one or more RFC822-style comma-separated email addresses * with the form "display name
" into an array of name/address pairs. - * Uses a simpler parser that does not require the IMAP extension but doesnt support + * Uses a simpler parser that does not require the IMAP extension but doesn't support * the full RFC822 spec. For full RFC822 support, use the PHP IMAP extension. * * @param string $addrstr The address list string @@ -1352,13 +1372,10 @@ public static function parseAddresses($addrstr, $useimap = null, $charset = self */ protected static function parseSimplerAddresses($addrstr, $charset) { - // Emit a runtime notice to recommend using the IMAP extension for full RFC822 parsing - trigger_error(self::lang('imap_recommended'), E_USER_NOTICE); - $addresses = []; $list = explode(',', $addrstr); foreach ($list as $address) { - $address = trim($address); + $address = trim($address, self::TRIM_CHARACTERS); //Is there a separate name part? if (strpos($address, '<') === false) { //No separate name, just use the whole thing @@ -1395,7 +1412,7 @@ protected static function parseSimplerAddresses($addrstr, $charset) */ private static function parseEmailString($input) { - $input = trim((string)$input); + $input = trim((string)$input, self::TRIM_CHARACTERS); if ($input === '') { return ['name' => '', 'email' => '']; @@ -1412,10 +1429,10 @@ private static function parseEmailString($input) $name = $matches[2]; // Simplest scenario, name and email are in the format "Name ". } elseif (isset($matches[3])) { - $name = trim($matches[3]); + $name = trim($matches[3], self::TRIM_CHARACTERS); } - return ['name' => $name, 'email' => trim($matches[4])]; + return ['name' => $name, 'email' => trim($matches[4], self::TRIM_CHARACTERS)]; } return ['name' => '', 'email' => $input]; @@ -1438,8 +1455,8 @@ public function setFrom($address, $name = '', $auto = true) //Helps avoid a deprecation warning in the preg_replace() below $name = ''; } - $address = trim((string)$address); - $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim + $address = trim((string)$address, self::TRIM_CHARACTERS); + $name = trim(preg_replace('/[\r\n]+/', '', $name), self::TRIM_CHARACTERS); //Strip breaks and trim //Don't validate now addresses with IDN. Will be done in send(). $pos = strrpos($address, '@'); if ( @@ -1486,8 +1503,8 @@ public function getLastMessageID() * Check that a string looks like an email address. * Validation patterns supported: * * `auto` Pick best pattern automatically; - * * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0; - * * `pcre` Use old PCRE implementation; + * * `pcre8` (deprecated, will convert to PHP validator) Use the squiloople.com pattern, requires PCRE > 8.0 + * * `pcre` (deprecated, will convert to PHP validator) Use old PCRE implementation, kept for BC; * * `php` Use PHP built-in FILTER_VALIDATE_EMAIL; * * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements. * * `eai` Use a pattern similar to the HTML5 spec for 'email' and to firefox, extended to support EAI (RFC6530). @@ -1503,7 +1520,8 @@ public function getLastMessageID() * You can also set the PHPMailer::$validator static to a callable, allowing built-in methods to use your validator. * * @param string $address The email address to check - * @param string|callable $patternselect Which pattern to use + * @param string|callable $patternselect Which pattern to use; + * the `pcre` and `pcre8` patterns are deprecated * * @return bool */ @@ -1521,7 +1539,7 @@ public static function validateAddress($address, $patternselect = null) return false; } switch ($patternselect) { - case 'pcre': //Kept for BC + case 'pcre': //Deprecated, kept for BC case 'pcre8': /* * A more complex and more permissive version of the RFC5322 regex on which FILTER_VALIDATE_EMAIL @@ -1620,10 +1638,17 @@ public function punyencodeAddress($address) static::idnSupported() ) { $domain = substr($address, ++$pos); + $charset = $this->CharSet; + if ( + strtolower($charset) === self::CHARSET_ISO88591 && + mb_check_encoding($domain, self::CHARSET_UTF8) + ) { + $charset = self::CHARSET_UTF8; + } //Verify CharSet string is a valid one, and domain properly encoded in this CharSet. - if ($this->has8bitChars($domain) && @mb_check_encoding($domain, $this->CharSet)) { + if ($this->has8bitChars($domain) && @mb_check_encoding($domain, $charset)) { //Convert the domain from whatever charset it's in to UTF-8 - $domain = mb_convert_encoding($domain, self::CHARSET_UTF8, $this->CharSet); + $domain = mb_convert_encoding($domain, self::CHARSET_UTF8, $charset); //Ignore IDE complaints about this line - method signature changed in PHP 5.4 $errorcode = 0; if (defined('INTL_IDNA_VARIANT_UTS46')) { @@ -1718,7 +1743,7 @@ public function preSend() //while remaining compatible with legacy SMTP servers to //the greatest degree possible: If the message uses //Unicode in the local parts of any addresses, it is sent - //using SMTPUTF8. If not, it it sent using + //using SMTPUTF8. If not, it is sent using //punycode-encoded domains and plain SMTP. if ( static::CHARSET_UTF8 === strtolower($this->CharSet) && @@ -1746,7 +1771,7 @@ public function preSend() $this->{$address_kind} = ''; continue; } - $this->{$address_kind} = trim($this->{$address_kind}); + $this->{$address_kind} = trim($this->{$address_kind}, self::TRIM_CHARACTERS); if (empty($this->{$address_kind})) { continue; } @@ -1775,13 +1800,12 @@ public function preSend() $this->setMessageType(); //Refuse to send an empty message unless we are specifically allowing it - if (!$this->AllowEmpty && empty($this->Body)) { + if (!$this->AllowEmpty && empty($this->Body) && '0' !== $this->Body) { throw new Exception(self::lang('empty_message'), self::STOP_CRITICAL); } //Trim subject consistently - $this->Subject = trim($this->Subject); - + $this->Subject = trim($this->Subject, self::TRIM_CHARACTERS); //Create body before headers in case body makes changes to headers (e.g. altering transfer encoding) $this->MIMEHeader = ''; @@ -1805,7 +1829,13 @@ public function preSend() ); } - //Sign with DKIM if enabled + //Sign with DKIM if enabled and params are valid + if (!static::isValidHost($this->DKIM_domain)) { + $this->DKIM_domain = ''; + } + if (!$this->validateDKIMSelector($this->DKIM_selector)) { + $this->DKIM_selector = ''; + } if ( !empty($this->DKIM_domain) && !empty($this->DKIM_selector) @@ -1930,7 +1960,7 @@ protected function sendmailSend($header, $body) $resultArgs = (empty($sendmailArgs) ? '' : ' ' . implode(' ', $sendmailArgs)); - $sendmail = trim(escapeshellcmd($this->Sendmail) . $resultArgs); + $sendmail = trim(escapeshellcmd($this->Sendmail) . $resultArgs, self::TRIM_CHARACTERS); $this->edebug('Sendmail path: ' . $this->Sendmail); $this->edebug('Sendmail command: ' . $sendmail); $this->edebug('Envelope sender: ' . $this->Sender); @@ -2089,7 +2119,8 @@ protected function mailSend($header, $body) foreach ($this->to as $toaddr) { $toArr[] = $this->addrFormat($toaddr); } - $to = trim(implode(', ', $toArr)); + //Fold long lists the same way as the To header, mail() keeps CRLF + WSP folds intact + $to = trim(substr($this->addrAppend('To', $this->to), strlen('To:')), self::TRIM_CHARACTERS); //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. @@ -2191,12 +2222,17 @@ public function setSMTPInstance(SMTP $smtp) */ public function setSMTPXclientAttribute($name, $value) { - if (!in_array($name, SMTP::$xclient_allowed_attributes)) { + if (!in_array($name, SMTP::$xclient_allowed_attributes, true)) { return false; } if (isset($this->SMTPXClient[$name]) && $value === null) { unset($this->SMTPXClient[$name]); } elseif ($value !== null) { + if (!is_string($value)) { + //Reject invalid XCLIENT attributes + return false; + } + //Values are stored raw and xtext-encoded at send time $this->SMTPXClient[$name] = $value; } @@ -2247,7 +2283,17 @@ protected function smtpSend($header, $body) $smtp_from = $this->Sender; } if (count($this->SMTPXClient)) { - $this->smtp->xclient($this->SMTPXClient); + if (!$this->smtp->xclient($this->SMTPXClient)) { + throw new Exception($this->smtp->getError()['error'], self::STOP_CRITICAL); + } + //XCLIENT success resets the session to the greeting protocol stage, + //so the client must send EHLO again before starting a transaction. + if ($this->Helo) { + $hello = $this->Helo; + } else { + $hello = $this->serverHostname(); + } + $this->smtp->hello($hello); } if (!$this->smtp->mail($smtp_from)) { $this->setError(self::lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError())); @@ -2353,11 +2399,11 @@ public function smtpConnect($options = null) if ( !preg_match( '/^(?:(ssl|tls):\/\/)?(.+?)(?::(\d+))?$/', - trim($hostentry), + trim($hostentry, self::TRIM_CHARACTERS), $hostinfo ) ) { - $this->edebug(self::lang('invalid_hostentry') . ' ' . trim($hostentry)); + $this->edebug(self::lang('invalid_hostentry') . ' ' . trim($hostentry, self::TRIM_CHARACTERS)); //Not a valid host entry continue; } @@ -2441,7 +2487,7 @@ public function smtpConnect($options = null) $this->oauth ) ) { - throw new Exception(self::lang('authenticate')); + throw new Exception($this->getSmtpErrorMessage('authenticate')); } return true; @@ -2646,7 +2692,22 @@ public function addrAppend($type, $addr) $addresses[] = $this->addrFormat($address); } - return $type . ': ' . implode(', ', $addresses) . static::$LE; + //Fold between addresses so that no line exceeds the RFC 2822 line length limit + $header = $type . ': ' . array_shift($addresses); + $lineLength = strlen($header); + foreach ($addresses as $address) { + //The address goes after ', ' and must still leave room for the ',' that ends + //the line if the next address gets folded + if ($lineLength + strlen(', ') + strlen($address) + strlen(',') > static::MAX_LINE_LENGTH) { + $header .= ',' . static::$LE . ' ' . $address; + $lineLength = strlen(' ') + strlen($address); + } else { + $header .= ', ' . $address; + $lineLength += strlen(', ') + strlen($address); + } + } + + return $header . static::$LE; } /** @@ -2663,8 +2724,12 @@ public function addrFormat($addr) return $this->secureHeader($addr[0]); } - return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase') . - ' <' . $this->secureHeader($addr[0]) . '>'; + $name = $this->encodeHeader($this->secureHeader($addr[1]), 'phrase'); + if ('' === $name) { //Nothing left after removing control characters + return $this->secureHeader($addr[0]); + } + + return $name . ' <' . $this->secureHeader($addr[0]) . '>'; } /** @@ -2740,6 +2805,11 @@ public function wrapText($message, $length, $qp_mode = false) } elseif ('=' === substr($word, $len - 2, 1)) { $len -= 2; } + if ($len < 1) { + //A run of continuation bytes as long as the line has no character boundary to + //break at; break at the full length, otherwise this loop never ends + $len = $length; + } $part = substr($word, 0, $len); $word = (string) substr($word, $len); @@ -2807,6 +2877,10 @@ public function utf8CharBoundary($encodedText, $maxLength) } elseif ($dec < 192) { //Middle byte of a multi byte character, look further back $lookBack += 3; + if ($lookBack > $maxLength) { + //No character starts within the line, so there is no boundary to split at + return 0; + } } } else { //No encoded character found @@ -2859,6 +2933,9 @@ public function createHeader() //The To header is created automatically by mail(), so needs to be omitted here if ('mail' !== $this->Mailer) { if ($this->SingleTo) { + //Rebuild the list on every call, otherwise recipients from earlier messages + //(or from earlier calls for the same message) would be sent to again + $this->SingleToArray = []; foreach ($this->to as $toaddr) { $this->SingleToArray[] = $this->addrFormat($toaddr); } @@ -2868,7 +2945,7 @@ public function createHeader() $result .= $this->headerLine('To', 'undisclosed-recipients:;'); } } - $result .= $this->addrAppend('From', [[trim($this->From), $this->FromName]]); + $result .= $this->addrAppend('From', [[trim($this->From, self::TRIM_CHARACTERS), $this->FromName]]); //sendmail and mail() extract Cc from the header before sending if (count($this->cc) > 0) { @@ -2912,6 +2989,7 @@ public function createHeader() $this->lastMessageID = sprintf('<%s@%s>', $this->uniqueid, $this->serverHostname()); } $result .= $this->headerLine('Message-ID', $this->lastMessageID); + $this->Priority = self::sanitisePriority($this->Priority); if (null !== $this->Priority) { $result .= $this->headerLine('X-Priority', $this->Priority); } @@ -2921,9 +2999,9 @@ public function createHeader() 'X-Mailer', 'PHPMailer ' . self::VERSION . ' (https://github.com/PHPMailer/PHPMailer)' ); - } elseif (is_string($this->XMailer) && trim($this->XMailer) !== '') { + } elseif (is_string($this->XMailer) && trim($this->XMailer, self::TRIM_CHARACTERS) !== '') { //Some string - $result .= $this->headerLine('X-Mailer', $this->secureHeader(trim($this->XMailer))); + $result .= $this->headerLine('X-Mailer', $this->secureHeader(trim($this->XMailer, self::TRIM_CHARACTERS))); } //Other values result in no X-Mailer header if ('' !== $this->ConfirmReadingTo) { @@ -2933,8 +3011,8 @@ public function createHeader() //Add custom headers foreach ($this->CustomHeader as $header) { $result .= $this->headerLine( - trim($header[0]), - $this->encodeHeader(trim($header[1])) + trim($header[0], self::TRIM_CHARACTERS), + $this->encodeHeader(trim($header[1], self::TRIM_CHARACTERS)) ); } if (!$this->sign_key_file) { @@ -3149,20 +3227,7 @@ public function createBody() $body .= $this->encodeString($this->Body, $bodyEncoding); $body .= static::$LE; if (!empty($this->Ical)) { - $method = static::ICAL_METHOD_REQUEST; - foreach (static::$IcalMethods as $imethod) { - if (stripos($this->Ical, 'METHOD:' . $imethod) !== false) { - $method = $imethod; - break; - } - } - $body .= $this->getBoundary( - $this->boundary[1], - '', - static::CONTENT_TYPE_TEXT_CALENDAR . '; method=' . $method, - '' - ); - $body .= $this->encodeString($this->Ical, $this->Encoding); + $body .= $this->getIcalPart($this->boundary[1]); $body .= static::$LE; } $body .= $this->endBoundary($this->boundary[1]); @@ -3192,6 +3257,10 @@ public function createBody() $body .= static::$LE; $body .= $this->attachAll('inline', $this->boundary[2]); $body .= static::$LE; + if (!empty($this->Ical)) { + $body .= $this->getIcalPart($this->boundary[1]); + $body .= static::$LE; + } $body .= $this->endBoundary($this->boundary[1]); break; case 'alt_attach': @@ -3217,20 +3286,7 @@ public function createBody() $body .= $this->encodeString($this->Body, $bodyEncoding); $body .= static::$LE; if (!empty($this->Ical)) { - $method = static::ICAL_METHOD_REQUEST; - foreach (static::$IcalMethods as $imethod) { - if (stripos($this->Ical, 'METHOD:' . $imethod) !== false) { - $method = $imethod; - break; - } - } - $body .= $this->getBoundary( - $this->boundary[2], - '', - static::CONTENT_TYPE_TEXT_CALENDAR . '; method=' . $method, - '' - ); - $body .= $this->encodeString($this->Ical, $this->Encoding); + $body .= $this->getIcalPart($this->boundary[2]); } $body .= $this->endBoundary($this->boundary[2]); $body .= static::$LE; @@ -3265,6 +3321,10 @@ public function createBody() $body .= static::$LE; $body .= $this->attachAll('inline', $this->boundary[3]); $body .= static::$LE; + if (!empty($this->Ical)) { + $body .= $this->getIcalPart($this->boundary[2]); + $body .= static::$LE; + } $body .= $this->endBoundary($this->boundary[2]); $body .= static::$LE; $body .= $this->attachAll('attachment', $this->boundary[1]); @@ -3319,8 +3379,9 @@ public function createBody() @unlink($signed); //The message returned by openssl contains both headers and body, so need to split them up $parts = explode("\n\n", $body, 2); - $this->MIMEHeader .= $parts[0] . static::$LE . static::$LE; - $body = $parts[1]; + //openssl emits bare LF breaks, which SMTP servers may reject + $this->MIMEHeader .= static::normalizeBreaks($parts[0]) . static::$LE . static::$LE; + $body = static::normalizeBreaks($parts[1]); } else { @unlink($signed); throw new Exception(self::lang('signing') . openssl_error_string()); @@ -3382,6 +3443,32 @@ protected function getBoundary($boundary, $charSet, $contentType, $encoding) return $result; } + /** + * Return the iCal part of a multipart/alternative message: its boundary, headers and encoded body. + * The method in the Content-Type header is taken from the METHOD property of the iCal body. + * + * @param string $boundary + * + * @return string + */ + protected function getIcalPart($boundary) + { + $method = static::ICAL_METHOD_REQUEST; + foreach (static::$IcalMethods as $imethod) { + if (stripos($this->Ical, 'METHOD:' . $imethod) !== false) { + $method = $imethod; + break; + } + } + + return $this->getBoundary( + $boundary, + '', + static::CONTENT_TYPE_TEXT_CALENDAR . '; method=' . $method, + '' + ) . $this->encodeString($this->Ical, $this->Encoding); + } + /** * Return the end of a message boundary. * @@ -3569,14 +3656,14 @@ protected function attachAll($disposition_type, $boundary) if (!empty($name)) { $mime[] = sprintf( 'Content-Type: %s; name=%s%s', - $type, + static::secureHeader($type), static::quotedString($this->encodeHeader($this->secureHeader($name))), static::$LE ); } else { $mime[] = sprintf( 'Content-Type: %s%s', - $type, + static::secureHeader($type), static::$LE ); } @@ -3709,6 +3796,26 @@ public function encodeString($str, $encoding = self::ENCODING_BASE64) return $encoded; } + /** + * Quote and escape a string for use as an RFC 5322 phrase (for example, + * an address display name), without encoding it. + * + * @param string $str The string to quote + * + * @return string + */ + private static function quotePhrase($str) + { + //Escape just the characters that need it in a quoted-string: backslash and double quote; + //control characters have already been stripped by the caller + $encoded = addcslashes($str, "\\\""); + if (($str === $encoded) && strlen($str) === strspn($str, self::PHRASE_ATOM_CHARS)) { + return $encoded; + } + + return "\"$encoded\""; + } + /** * Encode a header value (not including its label) optimally. * Picks shortest of Q, B, or none. Result includes folding if needed. @@ -3723,21 +3830,36 @@ public function encodeString($str, $encoding = self::ENCODING_BASE64) public function encodeHeader($str, $position = 'text') { $position = strtolower($position); + if ('phrase' === $position) { + //RFC 5322 only allows control characters in a display name in its obsolete syntax, which must not be + //generated, so strip them; tab is allowed. ESC is kept for 7-bit charsets such as ISO-2022-JP, + //which use it in their escape sequences. + $str = preg_replace( + $this->is7bitStatefulCharset() ? '/[\000-\010\012-\032\034-\037\177]/' : '/[\000-\010\012-\037\177]/', + '', + $str + ); + } if ($this->UseSMTPUTF8 && !("comment" === $position)) { - return trim(static::normalizeBreaks($str)); + //Sending unencoded UTF-8 is legal when SMTPUTF8 is used. + //The phrase position has already been sanitised above, so the raw + //text can be returned for all positions except comment. + if ('phrase' === $position) { + //Under SMTPUTF8, RFC 6532 permits raw UTF-8 in a quoted string, + //so quote rather than Q/B-encode; the phrase must still be + //quoted and escaped to prevent address-list injection. + return self::quotePhrase($str); + } + + return trim(static::normalizeBreaks($str), self::TRIM_CHARACTERS); } $matchcount = 0; - switch (strtolower($position)) { + switch ($position) { case 'phrase': - if (!preg_match('/[\200-\377]/', $str)) { - //Can't use addslashes as we don't know the value of magic_quotes_sybase - $encoded = addcslashes($str, "\0..\37\177\\\""); - if (($str === $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) { - return $encoded; - } - - return "\"$encoded\""; + //A tab can stay in a quoted-string; ESC is only left for 7-bit stateful charsets, which need encoding + if (!preg_match('/[\033\200-\377]/', $str)) { + return self::quotePhrase($str); } $matchcount = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches); break; @@ -3751,7 +3873,9 @@ public function encodeHeader($str, $position = 'text') break; } - if ($this->has8bitChars($str)) { + //7-bit charsets such as ISO-2022-JP or UTF-7 write non-ASCII text with ASCII bytes, + //so only an ASCII-compatible charset can be relabelled as us-ascii + if ($this->has8bitChars($str) || $this->is7bitStatefulCharset()) { $charset = $this->CharSet; } else { $charset = static::CHARSET_ASCII; @@ -3790,21 +3914,21 @@ public function encodeHeader($str, $position = 'text') } else { $encoded = base64_encode($str); $maxlen -= $maxlen % 4; - $encoded = trim(chunk_split($encoded, $maxlen, "\n")); + $encoded = trim(chunk_split($encoded, $maxlen, "\n"), self::TRIM_CHARACTERS); } $encoded = preg_replace('/^(.*)$/m', ' =?' . $charset . "?$encoding?\\1?=", $encoded); break; case 'Q': $encoded = $this->encodeQ($str, $position); $encoded = $this->wrapText($encoded, $maxlen, true); - $encoded = str_replace('=' . static::$LE, "\n", trim($encoded)); + $encoded = str_replace('=' . static::$LE, "\n", trim($encoded, self::TRIM_CHARACTERS)); $encoded = preg_replace('/^(.*)$/m', ' =?' . $charset . "?$encoding?\\1?=", $encoded); break; default: return $str; } - return trim(static::normalizeBreaks($encoded)); + return trim(static::normalizeBreaks($encoded), self::TRIM_CHARACTERS); } /** @@ -3860,6 +3984,17 @@ public function hasMultiBytes($str) return false; } + /** + * Is the message charset a 7-bit charset such as ISO-2022-JP or UTF-7, which writes non-ASCII text + * with ASCII bytes and so can't be relabelled as us-ascii? + * + * @return bool + */ + protected function is7bitStatefulCharset() + { + return (bool) preg_match('/^(iso-2022-|utf-7|hz-gb-2312)/i', $this->CharSet); + } + /** * Does a string contain any 8-bit chars (in any charset)? * @@ -4359,8 +4494,8 @@ public function clearCustomHeader($name, $value = null) //Value passed in as name:value list($name, $value) = explode(':', $name, 2); } - $name = trim($name); - $value = (null === $value) ? null : trim($value); + $name = trim($name, self::TRIM_CHARACTERS); + $value = (null === $value) ? null : trim($value, self::TRIM_CHARACTERS); foreach ($this->CustomHeader as $k => $pair) { if ($pair[0] == $name) { @@ -4391,8 +4526,8 @@ public function replaceCustomHeader($name, $value = null) //Value passed in as name:value list($name, $value) = explode(':', $name, 2); } - $name = trim($name); - $value = (null === $value) ? '' : trim($value); + $name = trim($name, self::TRIM_CHARACTERS); + $value = (null === $value) ? '' : trim($value, self::TRIM_CHARACTERS); $replaced = false; foreach ($this->CustomHeader as $k => $pair) { @@ -4500,6 +4635,23 @@ private static function sanitiseDate($date) } } + /** + * Sanitise and validate an X-Priority header value. + * @see https://learn.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcmail/2bb19f1b-b35e-4966-b1cb-1afd044e83ab + * + * @param $priority + * + * @return int|null + */ + private static function sanitisePriority($priority) + { + if ($priority === null || (is_int($priority) && $priority >= 1 && $priority <= 5)) { + return $priority; + } + + return null; + } + /** * Get the server hostname. * Returns 'localhost.localdomain' if unknown. @@ -4554,10 +4706,42 @@ public static function isValidHost($host) //Is it a valid IPv4 address? return filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false; } + //Empty labels are invalid, but some PHP versions' URL validation accepts them + if (strpos($host, '..') !== false || $host[0] === '.') { + return false; + } //Is it a syntactically valid hostname (when embedded in a URL)? return filter_var('https://' . $host, FILTER_VALIDATE_URL) !== false; } + /** + * Validate a DKIM selector. + * RFC 6376 defers to RFC5321's `Domain` ABNF syntax for the selector, + * which is a series of one or more dot-separated `sub-domain`s. + * Underscores are allowed as `atext` characters, as selectors are + * commonly served from the `_domainkey` sub-domain. + * @see https://www.rfc-editor.org/info/rfc6376/#section-3.1 + * @see https://www.rfc-editor.org/info/rfc5321/#section-4.1.2 + * UTF-8 is supported indirectly through punyencode + * + * @param string $selector + * + * @return bool + */ + protected function validateDKIMSelector($selector) + { + if (is_string($selector) && $this->has8bitChars($selector)) { + $selector = $this->punyencodeAddress($selector); + } + + return is_string($selector) + && $selector !== '' + && preg_match( + '/^[A-Za-z0-9_](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?(?:\.[A-Za-z0-9_](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?)*$/', + $selector + ); + } + /** * Check whether the supplied address uses Unicode in the local part. * @@ -4596,7 +4780,6 @@ public function needsSMTPUTF8() return $this->UseSMTPUTF8; } - /** * Get an error message in the current language. * @@ -4672,8 +4855,8 @@ public function addCustomHeader($name, $value = null) //Value passed in as name:value list($name, $value) = explode(':', $name, 2); } - $name = trim($name); - $value = (null === $value) ? '' : trim($value); + $name = trim($name, self::TRIM_CHARACTERS); + $value = (null === $value) ? '' : trim($value, self::TRIM_CHARACTERS); //Ensure name is not empty, and that neither name nor value contain line breaks if (empty($name) || strpbrk($name . $value, "\r\n") !== false) { if ($this->exceptions) { @@ -4705,11 +4888,14 @@ public function getCustomHeaders() * $basedir is prepended when handling relative URLs, e.g. and must not be empty * will look for an image file in $basedir/images/a.png and convert it to inline. * If you don't provide a $basedir, relative paths will be left untouched (and thus probably break in email) + * Instead of a directory, $basedir can be a callable that receives each relative URL and returns + * an array with the image `data`, and optionally its `name` and MIME `type`, or null to leave the URL untouched. * Converts data-uri images into embedded attachments. * If you don't want to apply these transformations to your HTML, just set Body and AltBody directly. * * @param string $message HTML message string - * @param string $basedir Absolute path to a base directory to prepend to relative paths to images + * @param string|callable $basedir Absolute path to a base directory to prepend to relative paths to images, + * or a callable that returns the image for a relative URL * @param bool|callable $advanced Whether to use the internal HTML to text converter * or your own custom converter * @return string The transformed message body @@ -4728,6 +4914,11 @@ public function msgHTML($message, $basedir = '', $advanced = false) preg_match_all('/(? 1 && '/' !== substr($basedir, -1)) { //Ensure $basedir has a trailing / $basedir .= '/'; @@ -4766,8 +4957,8 @@ public function msgHTML($message, $basedir = '', $advanced = false) continue; } if ( - //Only process relative URLs if a basedir is provided (i.e. no absolute local paths) - !empty($basedir) + //Only process relative URLs if a basedir or resolver is provided (i.e. no absolute local paths) + (!empty($basedir) || null !== $resolver) //Ignore URLs containing parent dir traversal (..) && (strpos($url, '..') === false) //Do not change urls that are already inline images @@ -4782,21 +4973,34 @@ public function msgHTML($message, $basedir = '', $advanced = false) } //RFC2392 S 2 $cid = substr(hash('sha256', $url), 0, 32) . '@' . $cid_domain; - if (strlen($basedir) > 1 && '/' !== substr($basedir, -1)) { - $basedir .= '/'; - } - if (strlen($directory) > 1 && '/' !== substr($directory, -1)) { - $directory .= '/'; - } - if ( - $this->addEmbeddedImage( + if (null !== $resolver) { + $image = $resolver($url); + $added = is_array($image) && isset($image['data']) + && $this->addStringEmbeddedImage( + $image['data'], + $cid, + isset($image['name']) ? $image['name'] : $filename, + static::ENCODING_BASE64, + isset($image['type']) ? $image['type'] : static::_mime_types( + (string) static::mb_pathinfo($filename, PATHINFO_EXTENSION) + ) + ); + } else { + if (strlen($basedir) > 1 && '/' !== substr($basedir, -1)) { + $basedir .= '/'; + } + if (strlen($directory) > 1 && '/' !== substr($directory, -1)) { + $directory .= '/'; + } + $added = $this->addEmbeddedImage( $basedir . $directory . $filename, $cid, $filename, static::ENCODING_BASE64, static::_mime_types((string) static::mb_pathinfo($filename, PATHINFO_EXTENSION)) - ) - ) { + ); + } + if ($added) { $message = preg_replace( '/' . $images[1][$imgindex] . '=["\']' . preg_quote($url, '/') . '["\']/Ui', $images[1][$imgindex] . '="cid:' . $cid . '"', @@ -4848,8 +5052,22 @@ public function html2text($html, $advanced = false) return call_user_func($advanced, $html); } + //Drop the entire head section before stripping tags; its content is not useful in plain text. + //An earlier implementation also removed in-body script and style tags, + //but they are not valid, so not our problem; use the `$advanced` option if you want more control. + $headEnd = stripos($html, ''); + if (false !== $headEnd) { + $html = substr($html, $headEnd + strlen('')); + } + //Likewise, drop anything after the end of the body section, which is + //where trailing script tags may lurk. + $bodyEnd = stripos($html, ''); + if (false !== $bodyEnd) { + $html = substr($html, 0, $bodyEnd); + } + return html_entity_decode( - trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/si', '', $html))), + trim(strip_tags($html), self::TRIM_CHARACTERS), ENT_QUOTES, $this->CharSet ); @@ -5090,7 +5308,7 @@ public function set($name, $value = '') */ public function secureHeader($str) { - return trim(str_replace(["\r", "\n"], '', $str)); + return trim(str_replace(["\r", "\n"], '', $str), self::TRIM_CHARACTERS); } /** @@ -5429,7 +5647,18 @@ public function DKIM_Add($headers_line, $subject, $body) //Base64 of packed binary SHA-256 hash of body $DKIMb64 = base64_encode(pack('H*', hash('sha256', $body))); $ident = ''; - if ('' !== $this->DKIM_identity) { + if ( + '' !== $this->DKIM_identity && + ( + //Identity can be an email address + self::validateAddress($this->DKIM_identity) || + ( + //Or it can be a domain name, prefixed with @ + '@' === $this->DKIM_identity[0] && + self::isValidHost(substr($this->DKIM_identity, 1)) + ) + ) + ) { $ident = ' i=' . $this->DKIM_identity . ';' . static::$LE; } //The DKIM-Signature header is included in the signature *except for* the value of the `b` tag @@ -5452,7 +5681,10 @@ public function DKIM_Add($headers_line, $subject, $body) $headerValues . static::$LE . $dkimSignatureHeader ); $signature = $this->DKIM_Sign($canonicalizedHeaders); - $signature = trim(chunk_split($signature, self::STD_LINE_LENGTH - 3, static::$LE . self::FWS)); + $signature = trim( + chunk_split($signature, self::STD_LINE_LENGTH - 3, static::$LE . self::FWS), + self::TRIM_CHARACTERS + ); return static::normalizeBreaks($dkimSignatureHeader . $signature); } @@ -5472,7 +5704,7 @@ public static function hasLineLongerThanMax($str) /** * If a string contains any "special" characters, double-quote the name, - * and escape any double quotes with a backslash. + * and escape any double quotes and backslashes with a backslash. * * @param string $str * @@ -5482,10 +5714,10 @@ public static function hasLineLongerThanMax($str) */ public static function quotedString($str) { - if (preg_match('/[ ()<>@,;:"\/\[\]?=]/', $str)) { + if (preg_match('/[ ()<>@,;:"\/\[\]?=\\\\]/', $str)) { //If the string contains any of these chars, it must be double-quoted - //and any double quotes must be escaped with a backslash - return '"' . str_replace('"', '\\"', $str) . '"'; + //and any double quotes or backslashes must be escaped with a backslash + return '"' . addcslashes($str, '\\"') . '"'; } //Return the string untouched, it doesn't need quoting @@ -5494,57 +5726,121 @@ public static function quotedString($str) /** * Allows for public read access to 'to' property. - * Before the send() call, queued addresses (i.e. with IDN) are not yet included. + * Before the send() call, queued addresses (i.e. with IDN) are not yet included, + * unless $includeQueued is true; queued addresses are returned as they were added, + * without punycode conversion. + * + * @param bool $includeQueued Whether to include addresses queued until send() * * @return array */ - public function getToAddresses() + public function getToAddresses($includeQueued = false) { - return $this->to; + if (!$includeQueued) { + return $this->to; + } + + return $this->mergeQueuedAddresses($this->to, $this->RecipientsQueue, 'to'); } /** * Allows for public read access to 'cc' property. - * Before the send() call, queued addresses (i.e. with IDN) are not yet included. + * Before the send() call, queued addresses (i.e. with IDN) are not yet included, + * unless $includeQueued is true; queued addresses are returned as they were added, + * without punycode conversion. + * + * @param bool $includeQueued Whether to include addresses queued until send() * * @return array */ - public function getCcAddresses() + public function getCcAddresses($includeQueued = false) { - return $this->cc; + if (!$includeQueued) { + return $this->cc; + } + + return $this->mergeQueuedAddresses($this->cc, $this->RecipientsQueue, 'cc'); } /** * Allows for public read access to 'bcc' property. - * Before the send() call, queued addresses (i.e. with IDN) are not yet included. + * Before the send() call, queued addresses (i.e. with IDN) are not yet included, + * unless $includeQueued is true; queued addresses are returned as they were added, + * without punycode conversion. + * + * @param bool $includeQueued Whether to include addresses queued until send() * * @return array */ - public function getBccAddresses() + public function getBccAddresses($includeQueued = false) { - return $this->bcc; + if (!$includeQueued) { + return $this->bcc; + } + + return $this->mergeQueuedAddresses($this->bcc, $this->RecipientsQueue, 'bcc'); } /** * Allows for public read access to 'ReplyTo' property. - * Before the send() call, queued addresses (i.e. with IDN) are not yet included. + * Before the send() call, queued addresses (i.e. with IDN) are not yet included, + * unless $includeQueued is true; queued addresses are returned as they were added, + * without punycode conversion. + * + * @param bool $includeQueued Whether to include addresses queued until send() * * @return array */ - public function getReplyToAddresses() + public function getReplyToAddresses($includeQueued = false) { - return $this->ReplyTo; + if (!$includeQueued) { + return $this->ReplyTo; + } + + return $this->mergeQueuedAddresses($this->ReplyTo, $this->ReplyToQueue, 'Reply-To'); } /** * Allows for public read access to 'all_recipients' property. - * Before the send() call, queued addresses (i.e. with IDN) are not yet included. + * Before the send() call, queued addresses (i.e. with IDN) are not yet included, + * unless $includeQueued is true; queued addresses are returned as they were added, + * without punycode conversion. + * + * @param bool $includeQueued Whether to include addresses queued until send() * * @return array */ - public function getAllRecipientAddresses() + public function getAllRecipientAddresses($includeQueued = false) { - return $this->all_recipients; + if (!$includeQueued) { + return $this->all_recipients; + } + $recipients = $this->all_recipients; + foreach ($this->RecipientsQueue as $params) { + $recipients[strtolower($params[1])] = true; + } + + return $recipients; + } + + /** + * Append the queued addresses of one kind to a list of [address, name] pairs. + * + * @param array $addresses List of [address, name] pairs + * @param array $queue A queue of [kind, address, name] entries + * @param string $kind One of 'to', 'cc', 'bcc', or 'Reply-To' + * + * @return array + */ + protected function mergeQueuedAddresses(array $addresses, array $queue, $kind) + { + foreach ($queue as $params) { + if ($params[0] === $kind) { + $addresses[] = [$params[1], $params[2]]; + } + } + + return $addresses; } /** diff --git a/core/vendor/phpmailer/phpmailer/src/POP3.php b/core/vendor/phpmailer/phpmailer/src/POP3.php index 0ba9678373..3c53b8e094 100644 --- a/core/vendor/phpmailer/phpmailer/src/POP3.php +++ b/core/vendor/phpmailer/phpmailer/src/POP3.php @@ -47,7 +47,7 @@ class POP3 * @var string * @deprecated This constant will be removed in PHPMailer 8.0. Use `PHPMailer::VERSION` instead. */ - const VERSION = '7.1.1'; + const VERSION = '7.4.1'; /** * Default POP3 port number. diff --git a/core/vendor/phpmailer/phpmailer/src/SMTP.php b/core/vendor/phpmailer/phpmailer/src/SMTP.php index f0957b80a9..1005ae0bcd 100644 --- a/core/vendor/phpmailer/phpmailer/src/SMTP.php +++ b/core/vendor/phpmailer/phpmailer/src/SMTP.php @@ -36,7 +36,7 @@ class SMTP * @var string * @deprecated This constant will be removed in PHPMailer 8.0. Use `PHPMailer::VERSION` instead. */ - const VERSION = '7.1.1'; + const VERSION = '7.4.1'; /** * SMTP line break constant. @@ -212,6 +212,7 @@ class SMTP /** * Allowed SMTP XCLIENT attributes. * Must be allowed by the SMTP server. EHLO response is not checked. + * This is a static rather than a constant because PHP 5.5 doesn't allow constant arrays. * * @see https://www.postfix.org/XCLIENT_README.html * @@ -275,6 +276,14 @@ class SMTP */ protected $last_reply = ''; + /** + * The last command sent to the server. + * Used to avoid sending QUIT while a DATA command is still in progress. + * + * @var string + */ + protected $state = ''; + /** * Output debugging info via a user-selected method. * @@ -328,8 +337,9 @@ protected function edebug($str, $level = 0) str_replace( "\n", "\n \t ", - trim($str) - ) + trim($str, PHPMailer::TRIM_CHARACTERS) + ), + PHPMailer::TRIM_CHARACTERS ), "\n"; } @@ -415,10 +425,14 @@ protected function getSMTPConnection($host, $port = null, $timeout = 30, $option $errno = 0; $errstr = ''; + //Warnings raised while connecting, e.g. TLS certificate verification failures, + //which often explain a failure better than $errstr does + $warnings = []; if ($streamok) { $socket_context = stream_context_create($options); - set_error_handler(function () { - call_user_func_array([$this, 'errorHandler'], func_get_args()); + set_error_handler(function ($errno, $errmsg, $errfile = '', $errline = 0) use (&$warnings) { + $warnings[] = $errmsg; + $this->errorHandler($errno, $errmsg, $errfile, $errline); }); $connection = stream_socket_client( $host . ':' . $port, @@ -434,8 +448,9 @@ protected function getSMTPConnection($host, $port = null, $timeout = 30, $option 'Connection: stream_socket_client not available, falling back to fsockopen', self::DEBUG_CONNECTION ); - set_error_handler(function () { - call_user_func_array([$this, 'errorHandler'], func_get_args()); + set_error_handler(function ($errno, $errmsg, $errfile = '', $errline = 0) use (&$warnings) { + $warnings[] = $errmsg; + $this->errorHandler($errno, $errmsg, $errfile, $errline); }); $connection = fsockopen( $host, @@ -449,9 +464,17 @@ protected function getSMTPConnection($host, $port = null, $timeout = 30, $option //Verify we connected properly if (!is_resource($connection)) { + $detail = trim( + (string) preg_replace( + '/\s+/', + ' ', + implode(' ', array_unique(array_filter(array_merge($warnings, [$errstr])))) + ), + PHPMailer::TRIM_CHARACTERS + ); $this->setError( 'Failed to connect to server', - '', + $detail, (string) $errno, $errstr ); @@ -489,6 +512,17 @@ public function startTLS() return false; } + //Anything that followed the reply to STARTTLS was sent before encryption started, + //so it must not be read later as if it came from the encrypted session + $info = stream_get_meta_data($this->smtp_conn); + if ($info['unread_bytes'] > 0) { + $this->setError('STARTTLS command failed', 'Unexpected data received before TLS negotiation'); + $this->edebug('SMTP ERROR: ' . $this->error['error'] . ': ' . $this->error['detail'], self::DEBUG_CLIENT); + $this->close(); + + return false; + } + //Allow the best TLS version(s) we can $crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT; @@ -671,10 +705,11 @@ public function authenticate( if (!$this->sendCommand('OAuth TOKEN', $oauth, [235, 334])) { return false; } - //If the server answers with 334, send an empty line and wait for a 235 + //If the server answers with 334, send an empty line + //a reply other than a 235 means the authentication failed, so we don't need to send anything else if ( - substr($this->last_reply, 0, 3) === '334' - && $this->sendCommand('AUTH End', '', 235) + strpos($this->last_reply, '334') === 0 + && !$this->sendCommand('AUTH End', '', 235) ) { return false; } @@ -762,6 +797,7 @@ public function close() { $this->server_caps = null; $this->helo_rply = null; + $this->state = ''; if (is_resource($this->smtp_conn)) { //Close the connection and cleanup fclose($this->smtp_conn); @@ -948,7 +984,7 @@ protected function parseHelloFields($type) foreach ($lines as $n => $s) { //First 4 chars contain response code followed by - or space - $s = trim(substr($s, 4)); + $s = trim(substr($s, 4), PHPMailer::TRIM_CHARACTERS); if (empty($s)) { continue; } @@ -1020,7 +1056,12 @@ public function mail($from) */ public function quit($close_on_error = true) { - $noerror = $this->sendCommand('QUIT', 'QUIT', 221); + if ($this->state === 'DATA') { + //The server would take QUIT as part of an unfinished message, so just close the connection + $noerror = true; + } else { + $noerror = $this->sendCommand('QUIT', 'QUIT', 221); + } $err = $this->error; //Save any error if ($noerror || $close_on_error) { $this->close(); @@ -1070,8 +1111,39 @@ public function recipient($address, $dsn = '') ); } + /** + * Encode a string using xtext encoding as defined in RFC 1891 & 3461, + * as required for XCLIENT attribute values: any octet outside + * printable US-ASCII (33-126), including '+', whitespace, and control + * characters, is encoded as '+' followed by two uppercase hexadecimal + * digits. Values encoded this way cannot inject additional attributes. + * + * @param string $value The string to encode + * + * @return string The xtext-encoded string + */ + public static function xtext($value) + { + return preg_replace_callback( + '/[^\x21-\x7E]|\+/', + static function ($matches) { + return sprintf('+%02X', ord($matches[0])); + }, + $value + ); + } + /** * Send SMTP XCLIENT command to server and check its return code. + * On success the server resets the session to the initial greeting + * protocol stage and responds with 220, so a new EHLO is required + * before any MAIL command. + * + * Attribute values are xtext-encoded (RFC 1891 & 3461) before being + * sent. + * + * @see https://www.postfix.org/XCLIENT_README.html + * @see https://www.rfc-editor.org/info/rfc3461/#section-4 * * @return bool True on success */ @@ -1079,14 +1151,20 @@ public function xclient(array $vars) { $xclient_options = ""; foreach ($vars as $key => $value) { - if (in_array($key, SMTP::$xclient_allowed_attributes)) { - $xclient_options .= " {$key}={$value}"; + if (!in_array($key, SMTP::$xclient_allowed_attributes)) { + $this->setError("Invalid XCLIENT attribute name: $key"); + return false; } + if (!is_string($value)) { + $this->setError("XCLIENT attribute value for $key must be a string"); + return false; + } + $xclient_options .= " {$key}=" . static::xtext($value); } if (!$xclient_options) { return true; } - return $this->sendCommand('XCLIENT', 'XCLIENT' . $xclient_options, 250); + return $this->sendCommand('XCLIENT', 'XCLIENT' . $xclient_options, 220); } /** @@ -1123,6 +1201,7 @@ protected function sendCommand($command, $commandstring, $expect) return false; } + $this->state = $command; $this->client_send($commandstring . static::LE, $command); $this->last_reply = $this->get_lines(); @@ -1243,9 +1322,16 @@ public function client_send($data, $command = '') //it can leak credentials, so hide credentials in all but lowest level if ( self::DEBUG_LOWLEVEL > $this->do_debug && - in_array($command, ['User & Password', 'Username', 'Password'], true) + in_array($command, ['User & Password', 'Username', 'Password', 'OAuth TOKEN'], true) ) { $this->edebug('CLIENT -> SERVER: [credentials hidden]', self::DEBUG_CLIENT); + } elseif ( + self::DEBUG_LOWLEVEL > $this->do_debug && + 'AUTH' === $command && + strpos($data, 'AUTH XOAUTH2 ') === 0 + ) { + //The token follows the command on the same line + $this->edebug('CLIENT -> SERVER: AUTH XOAUTH2 [credentials hidden]', self::DEBUG_CLIENT); } else { $this->edebug('CLIENT -> SERVER: ' . $data, self::DEBUG_CLIENT); } @@ -1401,7 +1487,7 @@ protected function get_lines() //Deliberate noise suppression - errors are handled afterwards $str = @fgets($this->smtp_conn, self::MAX_REPLY_LENGTH); - $this->edebug('SMTP INBOUND: "' . trim($str) . '"', self::DEBUG_LOWLEVEL); + $this->edebug('SMTP INBOUND: "' . trim($str, PHPMailer::TRIM_CHARACTERS) . '"', self::DEBUG_LOWLEVEL); $data .= $str; //If response is only 3 chars (not valid, but RFC5321 S4.2 says it must be handled), //or 4th character is a space or a line break char, we are done reading, break the loop. @@ -1592,7 +1678,7 @@ protected function recordLastTransactionID() foreach ($this->smtp_transaction_id_patterns as $smtp_transaction_id_pattern) { $matches = []; if (preg_match($smtp_transaction_id_pattern, $reply, $matches)) { - $this->last_smtp_transaction_id = trim($matches[1]); + $this->last_smtp_transaction_id = trim($matches[1], PHPMailer::TRIM_CHARACTERS); break; } } diff --git a/install/stubs/file_for_delete.txt b/install/stubs/file_for_delete.txt index 28b72b592a..f860979d1b 100644 --- a/install/stubs/file_for_delete.txt +++ b/install/stubs/file_for_delete.txt @@ -8,3 +8,4 @@ {core}src/Facades/UserManager.php {core}src/Interfaces/ServiceInterface.php {core}vendor/illuminate/support/Traits/Conditionable.php +{core}vendor/illuminate/support/Collection.php