wp/wp-includes/class-wp-phpmailer.php
author ymh <ymh.work@gmail.com>
Mon, 08 Sep 2025 19:44:41 +0200
changeset 23 417f20492bf7
parent 22 8c2e4d02f4ef
permissions -rw-r--r--
Update Docker configuration and plugin versions - Upgrade MariaDB from 10.6 to 11 with auto-upgrade support - Add WordPress debug environment variable to FPM container - Update PHP-FPM Dockerfile base image - Update Include Mastodon Feed plugin with bug fixes and improvements - Update Portfolio plugin (v2.58) with latest translations and demo data enhancements - Remove old README.md from Mastodon Feed plugin 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
/**
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
 * WordPress PHPMailer class.
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
 *
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
 * @package WordPress
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
 * @since 6.8.0
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
 */
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
/**
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
 * WordPress PHPMailer class.
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
 *
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
 * Overrides the internationalization method in order to use WordPress' instead.
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
 *
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
 * @since 6.8.0
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
 */
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
class WP_PHPMailer extends PHPMailer\PHPMailer\PHPMailer {
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
	/**
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
	 * Constructor.
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
	 *
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
	 * @since 6.8.0
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
	 *
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
	 * @param bool $exceptions Optional. Whether to throw exceptions for errors. Default false.
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
	 */
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
	public function __construct( $exceptions = false ) {
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
		parent::__construct( $exceptions );
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
		$this->SetLanguage();
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
	}
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
	/**
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
	 * Defines the error messages using WordPress' internationalization method.
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
	 *
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
	 * @since 6.8.0
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
	 *
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
	 * @return true Always returns true.
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
	 */
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
	public function SetLanguage( $langcode = 'en', $lang_path = '' ) {
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
		$error_strings  = array(
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
			'authenticate'         => __( 'SMTP Error: Could not authenticate.' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
			'buggy_php'            => sprintf(
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
				/* translators: 1: mail.add_x_header. 2: php.ini */
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
				__(
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
					'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.'
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
				),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
				'mail.add_x_header',
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
				'php.ini'
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
			),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
			'connect_host'         => __( 'SMTP Error: Could not connect to SMTP host.' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
			'data_not_accepted'    => __( 'SMTP Error: data not accepted.' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
			'empty_message'        => __( 'Message body empty' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
			/* translators: There is a space after the colon. */
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
			'encoding'             => __( 'Unknown encoding: ' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
			/* translators: There is a space after the colon. */
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
			'execute'              => __( 'Could not execute: ' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
			/* translators: There is a space after the colon. */
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
			'extension_missing'    => __( 'Extension missing: ' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
			/* translators: There is a space after the colon. */
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
			'file_access'          => __( 'Could not access file: ' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
			/* translators: There is a space after the colon. */
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
			'file_open'            => __( 'File Error: Could not open file: ' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
			/* translators: There is a space after the colon. */
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
			'from_failed'          => __( 'The following From address failed: ' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
			'instantiate'          => __( 'Could not instantiate mail function.' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    64
			/* translators: There is a space after the colon. */
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
			'invalid_address'      => __( 'Invalid address: ' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
			'invalid_header'       => __( 'Invalid header name or value' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
			/* translators: There is a space after the colon. */
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
			'invalid_hostentry'    => __( 'Invalid hostentry: ' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    69
			/* translators: There is a space after the colon. */
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    70
			'invalid_host'         => __( 'Invalid host: ' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    71
			/* translators: There is a space at the beginning. */
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
			'mailer_not_supported' => __( ' mailer is not supported.' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
			'provide_address'      => __( 'You must provide at least one recipient email address.' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    74
			/* translators: There is a space after the colon. */
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    75
			'recipients_failed'    => __( 'SMTP Error: The following recipients failed: ' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    76
			/* translators: There is a space after the colon. */
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    77
			'signing'              => __( 'Signing Error: ' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    78
			/* translators: There is a space after the colon. */
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
			'smtp_code'            => __( 'SMTP code: ' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    80
			/* translators: There is a space after the colon. */
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    81
			'smtp_code_ex'         => __( 'Additional SMTP info: ' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    82
			'smtp_connect_failed'  => __( 'SMTP connect() failed.' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    83
			/* translators: There is a space after the colon. */
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    84
			'smtp_detail'          => __( 'Detail: ' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    85
			/* translators: There is a space after the colon. */
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    86
			'smtp_error'           => __( 'SMTP server error: ' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    87
			/* translators: There is a space after the colon. */
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    88
			'variable_set'         => __( 'Cannot set or reset variable: ' ),
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    89
		);
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    90
		$this->language = $error_strings;
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    91
		return true;
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
	}
8c2e4d02f4ef Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    93
}