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

EmailStr is not case-sensitive on local part of email per RFC 5321 #798

henriklindgren opened this issue Sep 9, 2019 · 4 comments
bug help wanted


Copy link

@henriklindgren henriklindgren commented Sep 9, 2019


EmailStr validate-method performs lower() on whole string including local part, violating RFC 5321 by not conforming to

The local-part of a mailbox MUST BE treated as case sensitive.


return name or email[: email.index('@')], email.lower()

  • OS: Any
  • Python version import sys; print(sys.version): Any
  • Pydantic version import pydantic; print(pydantic.VERSION): 0.32.2

Where possible please include a self contained code snippet describing your bug:

import pydantic
assert pydantic.EmailStr.validate('') == ''
Copy link

@samuelcolvin samuelcolvin commented Sep 9, 2019

Thanks for reporting, PR welcome to fix this.

Copy link

@dmontagu dmontagu commented Oct 7, 2019

Closing as it looks like this was addressed by #801. Thanks for the contribution @henriklindgren!

@dmontagu dmontagu closed this as completed Oct 7, 2019
Copy link

@slavugan slavugan commented Apr 5, 2021

this RFC 5321 looks outdated as most email services works with emails as case insensitive, and following this RFC just complicates our life. just IMHO.

Copy link

@emilpaw emilpaw commented Apr 8, 2021

Is there a simple way to get the old behavior back?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
bug help wanted
None yet

No branches or pull requests

5 participants