EmailValidator icon indicating copy to clipboard operation
EmailValidator copied to clipboard

RE: Emails with no top level domain suffix are coming through as valid

Open bretto36 opened this issue 2 years ago • 5 comments

I'm using Laravel, which utilizes this library under the hood. I have an email which is coming through as valid but i don't think it should be. I'm not across the current standard oh what constitutes a valid email, but i assume it would need a top level suffix of some sort.

sales@test is the email that comes back as valid

$email = 'sales@test';

        $validator = \Validator::make(['email' => $email], [
            'email' => 'required|email',
        ]);

        try {
            $validator->validate();
        } catch (\Exception $e) {
            dd('invalid');
        }

        dd('valid');

bretto36 avatar Feb 07 '23 20:02 bretto36

Please take a look at this, I am facing the same issue here!

FrazeColder avatar Mar 21 '23 20:03 FrazeColder

Same issue. If this is expected behavior, please give us a simple way to override it.

joleenshook avatar Mar 30 '23 21:03 joleenshook

+1 to have a proper way to override this.

Having the same issue with this library in Drupal.

MatthieuScarset avatar Apr 02 '23 23:04 MatthieuScarset

Hi folks. Apologies for the delay. This is the expected behaviour, as email RFCs do not explicitly state there should be a TLD.

Now, reflecting on this and given that I'm following RFC 1035 for the domain part, it is true it should require to have a TLD.

Will work on this.

egulias avatar Apr 04 '23 08:04 egulias

I'm not well versed in creating & using lexers, but I'm going to guess the issue lies here as that's the only place $tldMissing is set to false, when it should be true in an example@notld input.

nikspyratos avatar Oct 06 '23 08:10 nikspyratos