Commit c6a8952c authored by Jake Spurlock's avatar Jake Spurlock
Browse files

Mail: PHPMailer swap to use is_email for the default validator.

Prior to the PHPMailer update in 5.5, old version of the PHPMailer was setting the validator to 'auto' resulting in a sophisticated logic for determining what email address validation should be used. But the new version defaults to 'php', possibly leading to rejection of email addresses which were fine prior to the upgrade. Let's use the WordPress core function `is_email()` so that it can be fully pluggable.

Fixes #50720.
Props david.binda, ayeshrajans, Synchro, SergeyBiryukov, whyisjake.

Built from https://develop.svn.wordpress.org/trunk@48645


git-svn-id: https://core.svn.wordpress.org/trunk@48407 1a063a9b-81f0-0310-95a4-ce76da25c4cd
parent 39e34fd8
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -216,6 +216,10 @@ if ( ! function_exists( 'wp_mail' ) ) :
			require_once ABSPATH . WPINC . '/PHPMailer/SMTP.php';
			require_once ABSPATH . WPINC . '/PHPMailer/Exception.php';
			$phpmailer = new PHPMailer\PHPMailer\PHPMailer( true );

			$phpmailer::$validator = static function ( $email ) {
				return (bool) is_email( $email );
			};
		}

		// Headers.
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@
 *
 * @global string $wp_version
 */
$wp_version = '5.5-beta3-48644';
$wp_version = '5.5-beta3-48645';

/**
 * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.