Hi,
a user to my site has reported that she was unable to register with her normal a-mail address, which is some//thing(at)c.dk She gets the message 'invalid e-mail address' or something like that. This IS a valid address, btw.

Help
Kaspar

Comments

ax’s picture

in includes/common.inc. c.dk doesn't look like a valid domain name to me, by the way.

hrkaspar’s picture

It doesn't make any sense to me (I am not any good at .php). I assumed it was the one letter domain that was drupal wasn't able to handle, but I can't see where length of domain is set.

includes/common.inc:

/**
* Verify the syntax of the given e-mail address. Empty e-mail addresses
* are allowed. See RFC 2822 for details.
*
* @param $mail a email address
*/
function valid_email_address($mail) {
$user = '[a-zA-Z0-9_\-\.\+\^!#\$%&*+\/\=\?\`\|\{\}~\']+';
$domain = '(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]\.?)+';
$ipv4 = '[0-9]{1,3}(\.[0-9]{1,3}){3}';
$ipv6 = '[0-9a-fA-F]{1,4}(\:[0-9a-fA-F]{1,4}){7}';

if (preg_match("/^$user@($domain|(\[($ipv4|$ipv6)\]))$/", $mail)) {
return 1;
}
else {
return 0;
}
}