in the function valid_email_address(), the email address test.@example.com (note the dot after "test"!) is suggested invalid.
This implies that drupal does not accept addresses with dots at the end of the $user part.
I know 2 people who have such an email address - both can't submit their email at my site.
This should be corrected.

Comments

nerdoc’s picture

Version: 6.x-dev » 7.14
ankur’s picture

Version: 7.14 » 8.x-dev

Well, according to specification for email addresses in RFC 5321 and RFC 5322, you're not allowed to start or end the local-part of an email address with a ".". Nor are you allowed to have 2 consecutive "." characters in sequence.

For a summary, see http://en.wikipedia.org/wiki/Email_address#Invalid_email_addresses

However, there are a lot of email addresses out that that don't conform to this specification. The question is: do we accommodate those email addresses by writing our own validation function or do we stick to the current implementation, which uses PHP's filter_var() function (with PHP's FILTER_VALIDATE_EMAIL filter to enforce the specification.

Switching version to 8.x. If any action is taken, it'll probably be back-ported to 7.x.

cilefen’s picture

Issue summary: View changes
Status: Active » Postponed (maintainer needs more info)

valid_email_address() has been deprecated and replaced with egulias/email-validator. Please re-test.

a.milkovsky’s picture

Version: 8.0.x-dev » 7.x-dev
Status: Postponed (maintainer needs more info) » Active

valid_email_address is used for Drupal 7. Issue is relevant for 7.x

The issue is described at http://php.net/manual/en/filter.filters.validate.php#101693 :

FILTER_VALIDATE_EMAIL does NOT allow incomplete e-mail addresses to be validated as mentioned by Tomas.

Using the following code:

$email = "clifton@example"; //Note the .com missing 
echo "PHP Version: ".phpversion().'<br>'; 
if(filter_var($email, FILTER_VALIDATE_EMAIL)){ 
    echo $email.'<br>'; 
    var_dump(filter_var($email, FILTER_VALIDATE_EMAIL)); 
}else{ 
    var_dump(filter_var($email, FILTER_VALIDATE_EMAIL));    
} 

Returns:
PHP Version: 5.2.14 //On MY server, may be different depending on which version you have installed.
bool(false)

While the following code:

$email = "clifton@example.com"; //Note the .com added 
echo "PHP Version: ".phpversion().'<br>'; 
if(filter_var($email, FILTER_VALIDATE_EMAIL)){ 
    echo $email.'<br>'; 
    var_dump(filter_var($email, FILTER_VALIDATE_EMAIL)); 
}else{ 
    var_dump(filter_var($email, FILTER_VALIDATE_EMAIL));    
} 

Returns:
PHP Version: 5.2.14 //On MY server, may be different depending on which version you have installed.
clifton@example.com
string(16) "clifton@example.com"

This feature is only available for PHP Versions (PHP 5 >= 5.2.0) according to documentation. So make sure your version is correct.

Would be good to replace valid_email_address(0 with something more reliable.

cilefen’s picture

Status: Active » Closed (duplicate)