Make WordPress Core


Ignore:
Timestamp:
07/27/2020 08:17:36 PM (4 years ago)
Author:
whyisjake
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/pluggable.php

    r48601 r48645  
    217217            require_once ABSPATH . WPINC . '/PHPMailer/Exception.php';
    218218            $phpmailer = new PHPMailer\PHPMailer\PHPMailer( true );
     219
     220            $phpmailer::$validator = static function ( $email ) {
     221                return (bool) is_email( $email );
     222            };
    219223        }
    220224
Note: See TracChangeset for help on using the changeset viewer.