-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Underscore in domain is accepted #5
Comments
This is basically the same thing as issue #2; RFC5322 is very loose with regards to domain names. My eventual intention is to add stronger validation for this based upon another package rather than including the code in email-validate, as domain parsing/validation has more widespread usages. |
Ok, sounds good. I just wanted to mention it because email-validate was failing the underscore test I developed for an old ruby validator I wrote. I left that test commented out for now. |
Thanks! I'll update my tests. |
Note this is not yet published to hackage. I'm thinking that it is going to be 3.0 as it breaks compatibility with existing addresses. |
Not a problem. I have a tool email-validator that uses email-validate for its syntax checks (which are a huge part of the program). I have no other reason to make a version bump, so I can wait and then update the version bounds to make sure my test suite passes. On a related note, I also wrote a domain name parser in the meantime for harbl but I never finished the project. It's not dead per se, I just have other things to do... The goal is to parse DNS blacklist names which are essentially domain names. Someday, if I finish it, I can try to split out the domain name parsing into a library. |
While underscores are legal in DNS, they're disallowed for hostnames. So you can't have either an 'A' or an 'MX' record for a name with an underscore in it, and thus no address with an underscore in it will be deliverable.
This is a gray area with respect to RFC5322, but I think it's best to reject them since in practice the addresses are invalid. A quote from the RFC:
The text was updated successfully, but these errors were encountered: