-
Notifications
You must be signed in to change notification settings - Fork 204
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
Allow address.parse() to reject addresses with local hostnames #201
Comments
It seems to be too use case specific to be included as a parser option. I can think of many similar specific use cases e.g.: do not allow domains of 3rd, 4th, Xth level; do not allow domains from specific top level domains; do not allow domains from a certain geo region... All that seems like a higher level of abstraction that lays out of the scope of the email address syntax parsing. In your case the solution is as simple as: addr = parse('bleah@example')
if addr and '.' in add.hostname:
// bingo
else:
// invalid address or local domain So I think it is out of the scope of Flanker and should not be implemented. @b0d0nne11 what do you think? |
I would agree. There maybe other users of the library that have a valid use case to send to |
To clarify, Brendan, I am not suggesting we remove the validation of addresses like |
Thanks for your feedback, Maxim. I do not see the other use cases you mention as being anywhere near as common, and I hope you will consider adding this option. In the meantime I will add a check in my script along the lines you suggest. |
Actually |
We don't really want to go to the trouble of calling |
address.parse()
currently accepts addresses with a single-part domain as used for a local mail host, e.g.bleah@example
. I am currently working on a use case where we would only want to send to Internet addresses, like[email protected]
or[email protected]
. It would be useful to have an option to reject addresses with single-part domains.The text was updated successfully, but these errors were encountered: