Files
wordpress/wp-includes/class-wp-phpmailer.php
Sergey Biryukov 66506c9fd6 External Libraries: Upgrade PHPMailer to version 6.10.0.
This is a feature and maintenance release introducing full support for [https://www.rfc-editor.org/rfc/rfc6531 RFC 6531 SMTPUTF8], meaning that plugin or theme developers are now free to use Unicode characters in email addresses, such as `JøeÜser@example.com`, without any complicated encoding schemes. Using this feature requires sending through a mail server that advertises support for SMTPUTF8. For full details see [https://github.com/PHPMailer/PHPMailer/blob/master/SMTPUTF8.md SMTPUTF8.md].

This commit also includes the parts of PHPMailer not previously bundled with core, specifically the DSNConfigurator, OAuth, and POP3 classes, so that plugin developers could use those extended features without including their own versions of the library.

Including the full library aims to make it easier (and faster) for core to update in case of security issues, and to provide more flexibility and security for plugins and (by extension) users of WordPress.

References:
* [https://github.com/PHPMailer/PHPMailer/releases/tag/v6.10.0 PHPMailer 6.10.0 release notes]
* [https://github.com/PHPMailer/PHPMailer/compare/v6.9.3...v6.10.0 Full list of changes in PHPMailer 6.10.0]

Follow-up to [54937], [55557], [56484], [57137], [59246], [59481].

Props agulbra, Ipstenu, JeffMatson, lukecavanagh, dd32, Otto42, JeffMatson, MattyRob, desrosj, SirLouen, SergeyBiryukov.
Fixes #39714, #63811.
Built from https://develop.svn.wordpress.org/trunk@60623


git-svn-id: http://core.svn.wordpress.org/trunk@59959 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-08-11 16:18:33 +00:00

97 lines
4.0 KiB
PHP

<?php
/**
* WordPress PHPMailer class.
*
* @package WordPress
* @since 6.8.0
*/
/**
* WordPress PHPMailer class.
*
* Overrides the internationalization method in order to use WordPress' instead.
*
* @since 6.8.0
*/
class WP_PHPMailer extends PHPMailer\PHPMailer\PHPMailer {
/**
* Constructor.
*
* @since 6.8.0
*
* @param bool $exceptions Optional. Whether to throw exceptions for errors. Default false.
*/
public function __construct( $exceptions = false ) {
parent::__construct( $exceptions );
$this->setLanguage();
}
/**
* Defines the error messages using WordPress' internationalization method.
*
* @since 6.8.0
*
* @param string $langcode Optional. Unused. ISO 639-1 2-character language code. Default 'en'.
* @param string $lang_path Optional. Unused. Path to the language file directory. Default empty string.
* @return true Always returns true.
*/
public function setLanguage( $langcode = 'en', $lang_path = '' ) {
$this->language = array(
'authenticate' => __( 'SMTP Error: Could not authenticate.' ),
'buggy_php' => sprintf(
/* translators: 1: mail.add_x_header. 2: php.ini */
__(
'Your version of PHP is affected by a bug that may result in corrupted messages. To fix it, switch to sending using SMTP, disable the %1$s option in your %2$s, or switch to MacOS or Linux, or upgrade your PHP version.'
),
'mail.add_x_header',
'php.ini'
),
'connect_host' => __( 'SMTP Error: Could not connect to SMTP host.' ),
'data_not_accepted' => __( 'SMTP Error: Data not accepted.' ),
'empty_message' => __( 'Message body empty' ),
/* translators: There is a space after the colon. */
'encoding' => __( 'Unknown encoding: ' ),
/* translators: There is a space after the colon. */
'execute' => __( 'Could not execute: ' ),
/* translators: There is a space after the colon. */
'extension_missing' => __( 'Extension missing: ' ),
/* translators: There is a space after the colon. */
'file_access' => __( 'Could not access file: ' ),
/* translators: There is a space after the colon. */
'file_open' => __( 'File Error: Could not open file: ' ),
/* translators: There is a space after the colon. */
'from_failed' => __( 'The following From address failed: ' ),
'instantiate' => __( 'Could not instantiate mail function.' ),
/* translators: There is a space after the colon. */
'invalid_address' => __( 'Invalid address: ' ),
'invalid_header' => __( 'Invalid header name or value' ),
/* translators: There is a space after the colon. */
'invalid_hostentry' => __( 'Invalid host entry: ' ),
/* translators: There is a space after the colon. */
'invalid_host' => __( 'Invalid host: ' ),
/* translators: There is a space at the beginning. */
'mailer_not_supported' => __( ' mailer is not supported.' ),
'provide_address' => __( 'You must provide at least one recipient email address.' ),
/* translators: There is a space after the colon. */
'recipients_failed' => __( 'SMTP Error: The following recipients failed: ' ),
/* translators: There is a space after the colon. */
'signing' => __( 'Signing Error: ' ),
/* translators: There is a space after the colon. */
'smtp_code' => __( 'SMTP code: ' ),
/* translators: There is a space after the colon. */
'smtp_code_ex' => __( 'Additional SMTP info: ' ),
'smtp_connect_failed' => __( 'SMTP connect() failed.' ),
/* translators: There is a space after the colon. */
'smtp_detail' => __( 'Detail: ' ),
/* translators: There is a space after the colon. */
'smtp_error' => __( 'SMTP server error: ' ),
/* translators: There is a space after the colon. */
'variable_set' => __( 'Cannot set or reset variable: ' ),
'no_smtputf8' => __( 'Server does not support SMTPUTF8 needed to send to Unicode addresses' ),
);
return true;
}
}