Skip to content
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

Bug: isEmail docs/source suggest allow_underscores is defaulted to false however [email protected] is valid by default #2504

Open
titanism opened this issue Nov 27, 2024 · 2 comments
Labels

Comments

@titanism
Copy link

As described in title.

@jamro
Copy link

jamro commented Dec 8, 2024

I think this is expected behaviour. According to RFC 5322, an underscore can appear in the local-part of the email address and is a valid character (when used before @). The underscore is not allowed in the domain name; however, there are some cases where it could appear in a subdomain. This is what allow_underscores flag is for.

If you want to exclude underscore from local-part of the email, use blacklisted_chars option:

validator.isEmail('[email protected]', { blacklisted_chars: '_' }) // false

@titanism
Copy link
Author

@jamro see #2508

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants