Skip to content

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

@henriklindgren

Description

@henriklindgren

Bug

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.
https://tools.ietf.org/rfc/rfc5321.txt

See
https://github.com/samuelcolvin/pydantic/blob/79017111aa030873f2dc54576e2c768d154b1be5/pydantic/networks.py#L383

  • 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('AbC@example.com') == 'AbC@example.com'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug V1Bug related to Pydantic V1.Xhelp wantedPull Request welcome

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions