Skip Navigation

[Resolved] Email validation does not allow valid address

This support ticket is created 4 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 5 replies, has 3 voices.

Last updated by Martin Sauter 4 years, 1 month ago.

Assisted by: Shane.

Author
Posts
#1837769

I have an email field with standard validation activated (no custom rules). This field does not accept the follow (valid) email address:

john.doe@unit.company.ch

It will however accept the following addresses:

john.doe@unit.company.com
john.doe@company.ch

So obviously there is a rule in place saying that within the top level domain «ch» (Switzerland) there are no third level domains allowed (which is simply wrong).

I am using WordPress 5.5.3 with Toolset Types 3.4.2.

#1838141

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Martin

The email validation uses an API that checks the real domains, it doesn't try to guess or use some regex to evaluate whether an email "looks like" a valid email address, it actually checks whether the domain (or subdomain in this case) exists with a DNS entry etc.

So the likely explanation for being unable to add an email address is that no such address exists in the real world.

#1838369

Hi Nigel

Thank you for your explanation. Indeed, the email address that initially caused the problem may be outdated.

But still I think that the validation rules are not the same for every top level domain.

Try the following addresses:

mail@43PxiCBkrTaV89.apple.com
mail@Td6AVgDQ9VgmL5.apple.com
mail@yEMhTdl7P7aHRZ.apple.com

Although the third level domain name is obviously just random, it will be accepted, as long as the top level domain is valid.

However, if you try the same thing with a valid Swiss domain, they will not validate:

mail@43PxiCBkrTaV89.toblerone.ch
mail@Td6AVgDQ9VgmL5.toblerone.ch
mail@yEMhTdl7P7aHRZ.toblerone.ch

Do you have an explanation for this behavior?

#1838641

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

The first validation test is with the PHP function getmxrr, as described here: hidden link

That is what produces the difference in results for .com than for .ch.

So both apple.com and sdfjkjsdfklj.apple.com return the following:

mxhosts: Array
(
    [0] => nwk-aaemail-lapp02.apple.com
    [1] => ma1-aaemail-dr-lapp03.apple.com
    [2] => nwk-aaemail-lapp01.apple.com
    [3] => ma1-aaemail-dr-lapp02.apple.com
    [4] => nwk-aaemail-lapp03.apple.com
    [5] => ma1-aaemail-dr-lapp01.apple.com
)

But with .ch, toblerone.ch returns

mxhosts: Array
(
    [0] => mx2.emailsrvr.com
    [1] => mx1.emailsrvr.com
)

Whereas sdfjkjsdfklj.toblerone.ch returns FALSE, and hence is rejected.

Naturally, we're not responsible for how getmxrr interprets this, and if the returned results were a problem it would mean us changing how email validation works so as not to use getmxrr.

But it seems like the problem here is that for .ch domains non-existant sub-domains are correctly being rejected, while for the example of apple.com non-existant sub-domains do get through (although maybe their MX settings have a catch-all for sub-domains, I don't know).

So I don't think there is anything else to do here, right?

#1839219

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Martin,

As Nigel mentioned there isn't anything else we can do here given the sub domain emails are currently being rejected.

So you can close here when ready.

Thanks,
Shane

#1839371

Thank you for the detailed information, Nigel!