The JMailHelper::isEmailAddress
function return true with invalid adress:
i tried with:
test.test@test
test.test@test.
Edit the index.php at the joomla root folder, add line at bottom:
var_dump(JMailHelper::isEmailAddress('test.test@test'));
boolean false = email invalid
boolean true = email valid ...
Email addresses without TLD are valid. E.g. local domain name like
admin@mailserver1
Labels |
Added:
?
|
Didn't knew that, sees quite logic :)
Closing as it is expected behavior for local domain names. Thanks everybody
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-10-26 20:03:44 |
Closed_By | ⇒ | zero-24 |
@bertmert thx, not noticed this
So there is no other way to check email address with tld (like JFormRuleEmail) with Joomla?
EDIT: just noticed there is something strange here: https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/form/rule/email.php#L60
regex with/without tld are same.
EDIT2: #4905 making me crazy as now test@test is valid with tld checking....
So there is no other way to check email address with tld
You could create someting like a feature request or PR. Implement tld-check in isEmailAddress(.
Looks not that complicated
public static function isEmailAddress($email, $tldcheck = 0)
and after line 155 ($domain_array = explode(".", rtrim($domain, '.'));)
if ($tldcheck && count($domain_array) < 2)
{
return false;
}
Call with tld-check
JMailHelper::isEmailAddress('test.test@test', 1)
regex with/without tld are same.
EDIT2: #4905 making me crazy as now test@test is valid with tld checking
I don't understand. If you think there's a bug open an new issue with some test instructions.
As far as I see you're right that line 28 and 60 of class JFormRuleEmail use identical regex. Looks strange.
Issue confirmed for the latest staging version of Joomla!