You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is not a minor feature, because RFCs are never simple. I haven't read the RFC in detail. The new email API (is supposed to) fully support RFC 6532 (see policy.SMTPUTF8), and can interoperate with smtplib to correctly send and receive internationalized email messages (at least in theory). Any new abilities/requirements in RFC 6530 that are not met by the existing code should be addressed in the new API. The legacy API only supports the older RFCs and so should not be modified.
Indeed email.headerregistry.Address could be used but it does not support neither non-ASCII local part if used with addr_spec argument.
So I think it should also be extended.
Right, that's where the extension should be done. I'd have to read the RFC to decide if a new policy flag is needed, but my guess from a very cursory skim is that it wouldn't be. I'm guessing allowing it if policy.utf8 is True would be enough. But like I said, I haven't actually read the RFC (yet).
We are attempting to address this issue in a different way in #81074. For the reasons discussed there the approach taken for the PR attached to this issue no longer seems optimal, so I'm closing this as a duplicate.
Activity
pythongh-118716: Do not enforce ASCII to format address
bitdancer commentedon May 7, 2024
This is not a minor feature, because RFCs are never simple. I haven't read the RFC in detail. The new email API (is supposed to) fully support RFC 6532 (see policy.SMTPUTF8), and can interoperate with smtplib to correctly send and receive internationalized email messages (at least in theory). Any new abilities/requirements in RFC 6530 that are not met by the existing code should be addressed in the new API. The legacy API only supports the older RFCs and so should not be modified.
cedk commentedon May 7, 2024
The formataddr is useful even with the new email API to format correctly the name and the address when you have only the name and the full address.
cedk commentedon May 8, 2024
Indeed
email.headerregistry.Addresscould be used but it does not support neither non-ASCII local part if used withaddr_specargument.So I think it should also be extended.
bitdancer commentedon May 9, 2024
Right, that's where the extension should be done. I'd have to read the RFC to decide if a new policy flag is needed, but my guess from a very cursory skim is that it wouldn't be. I'm guessing allowing it if policy.utf8 is True would be enough. But like I said, I haven't actually read the RFC (yet).
pythongh-118716: Do not fail on non ASCII local part when parsing add…
bitdancer commentedon Apr 18, 2026
We are attempting to address this issue in a different way in #81074. For the reasons discussed there the approach taken for the PR attached to this issue no longer seems optimal, so I'm closing this as a duplicate.