From 50d235ad101f61a6c6888316e827fd225ad4b9cd Mon Sep 17 00:00:00 2001 From: Damien Regad Date: Mon, 27 Jan 2014 12:13:54 +0100 Subject: [PATCH] Revert of "Use PHP's own email validation routines" This partially reverts commit 4235a08618da1d66b44337867b72f4fdea633dc0 which introduced a regression. The PHP email validation rejects valid e-mail addresses with the form user@hostname [1]. The PHPMailer accepts these, and furthermore it makes sense to rely on the validation routine provided by the library we use to send our emails. [1] https://bugs.php.net/bug.php?id=49576 --- core/email_api.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/email_api.php b/core/email_api.php index a3cb521e38..b34afc32b9 100644 --- a/core/email_api.php +++ b/core/email_api.php @@ -122,9 +122,9 @@ function email_is_valid( $p_email ) { return true; } - // check email address is a valid format - $t_email = filter_var($p_email, FILTER_SANITIZE_EMAIL); - if (filter_var($t_email, FILTER_VALIDATE_EMAIL)) { + # check email address is a valid format + $t_email = filter_var( $p_email, FILTER_SANITIZE_EMAIL ); + if( PHPMailer::ValidateAddress( $t_email ) ) { $t_domain = end( explode( '@', $t_email ) ); # see if we're limited to a set of known domains