validator.js icon indicating copy to clipboard operation
validator.js copied to clipboard

isEmail returns false when provided email with multiple periods before @

Open reserad opened this issue 3 years ago • 3 comments

Describe the bug When using isEmail with an email that has 2 or more periods before the @, it returns false.

Examples The email address "[email protected]" is considered valid by Gmail but isEmail("[email protected]") returns false.

Additional context Validator.js version: 13.7.0 Node.js version: 14.17.5 OS platform: macOS

reserad avatar Apr 04 '22 17:04 reserad

Tried it in gmail (in registration and as email recipient). It doesn't accept that email string.

heanzyzabala avatar Apr 11 '22 16:04 heanzyzabala

@heanzyzabala I have a Gmail is [email protected]. If you send a email to [email protected], this email will send to [email protected] You can read about it: https://gmail.googleblog.com/2008/03/2-hidden-ways-to-get-more-from-your.html

oHTGo avatar Apr 17 '22 08:04 oHTGo

@reserad You can find it in https://github.com/validatorjs/validator.js/blob/c1b21a9c8c5e6bd1597e26354c829ad232251f12/src/lib/isEmail.js#L104-L111

oHTGo avatar Apr 18 '22 03:04 oHTGo

@reserad - can this issue be closed as its invalid to have 2 or more consecutive dots in email address. Check this - https://serverfault.com/questions/395766/are-two-periods-allowed-in-the-local-part-of-an-email-address

meeraj257 avatar Sep 27 '22 21:09 meeraj257

Could it be desirable to add an option to this validator that lets you choose if you want to accept gmail's (seemingly) spec-breaking + ending?

braaar avatar Sep 28 '22 06:09 braaar