jstedfast / EmailValidation

A simple (but correct) .NET class for validating email addresses

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Digits in domain names clarification

sherlock1982 opened this issue · comments

In C# I use EmailValidation and in JS I use popular isemail library.

I noticed the following.
In isemail both foo@1111 and foo@1bar are invalid because they start with a digit.
In EmailValidation foo@1111 is invalid but foo@1bar is valid I guess because it contains letters.

I tried to understand who is correct.
According to rfc5321 domain consists of ascii letters, digits and hyphens and nowhere it says that it shouldn't start with a digit or that domain shouldn't consist of digits only.
To me both implementations are too restrictive here.

BTW in JS port you mentioned foo@1111 is considered valid so the port is kind a different

You need to read the RFC for domain names.

Suffice it to say that domains are not allowed to be all numeric (nor are they supposed to start with a number, but there are real-world examples that do).