?
avatar Devportobello
Devportobello
26 Oct 2015

The JMailHelper::isEmailAddress function return true with invalid adress:
i tried with:

test.test@test
test.test@test.

How to 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 ...

avatar Devportobello Devportobello - open - 26 Oct 2015
avatar n9iels
n9iels - comment - 26 Oct 2015

Issue confirmed for the latest staging version of Joomla!

avatar bertmert
bertmert - comment - 26 Oct 2015

Email addresses without TLD are valid. E.g. local domain name like
admin@mailserver1

avatar zero-24 zero-24 - change - 26 Oct 2015
Labels Added: ?
avatar n9iels
n9iels - comment - 26 Oct 2015

Didn't knew that, sees quite logic :)

avatar zero-24
zero-24 - comment - 26 Oct 2015

Closing as it is expected behavior for local domain names. Thanks everybody :smile:

avatar zero-24 zero-24 - change - 26 Oct 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-10-26 20:03:44
Closed_By zero-24
avatar zero-24 zero-24 - close - 26 Oct 2015
avatar zero-24 zero-24 - close - 26 Oct 2015
avatar Devportobello
Devportobello - comment - 27 Oct 2015

@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....

avatar bertmert
bertmert - comment - 27 Oct 2015

@Devportobello

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.

Add a Comment

Login with GitHub to post a comment