Domain name validation in Email validator
See original GitHub issueHello developers,
This is more of a question (possibly an issue). I was trying to validate some email addresses using the Email
validator class, when I stumbled on it not validating this particular email address: test@domain.c
I then looked into the code and found that the part after the .
in the domain name must be at least 2 characters.
May I ask what the reasoning behind this is?
I know email validation (and by extension domain name validation) can be a complicated issue, so I tried looking up if there are formal specifications that can be relied upon. I found that the format of the domain name is specified in this RFC, section 2.1 and by extension this RFC, section B. There seems to be no restrictions there on limiting the part after the .
to 2 characters.
I am on Python 3.5.2, running marshmallow version 2.10.3. Thanks in advance!
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
RFC states that top-level domain validation should check for all existing TLDs at the moment and be updated whenever TLD list changes. The validation regexp in Marshmallow is a simplified version that is commonly used. So, as of now it pretty consistent with RFCs. When 1 letter domain will be introduced, then it can be updated. As of now
test@domain.c
is incorrect email address.@maximkulkin I’m not in a position to decide any one change, though I tend to agree with @justanr. The RFC itself mentions validating using a DNS service, which may be local to specific users.
But anyway, I think this answers my initial question already. I’ll close this issue for now and leave it for reopening in a possible future where we have ICANN-approved single-letter TLDs 😃.
Thank you!