This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dracos
Recipients barry, dracos, r.david.murray
Date 2019-05-12.11:06:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1557659178.71.0.414757697263.issue36893@roundup.psfhosted.org>
In-reply-to
Content
The parser for passing an addr_spec to email.headerregistry.Address does not allow non-ASCII local parts, but the rest of the email package handles them fine, either straight (with explicit references to RFC6532 and SMTPUTF8), or encoding as expected. Apologies if I've misunderstood something.

>>> from email.message import EmailMessage
>>> msg = EmailMessage()
>>> msg['To'] = 'Matthéw <aé@example.com>'
>>> msg.as_string()
'To: =?utf-8?q?Matth=C3=A9w?= <=?utf-8?q?a=C3=A9?=@example.com>\n\n'
>>> msg['To'].addresses[0]
Address(display_name='Matthéw', username='aé', domain='example.com')
>>> msg['To'].addresses[0].addr_spec
'aé@example.com'
>>> email.headerregistry.Address(addr_spec=msg['To'].addresses[0].addr_spec)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/headerregistry.py", line 48, in __init__
    raise a_s.all_defects[0]
email.errors.NonASCIILocalPartDefect: local-part contains non-ASCII characters)
>>>
History
Date User Action Args
2019-05-12 11:06:18dracossetrecipients: + dracos, barry, r.david.murray
2019-05-12 11:06:18dracossetmessageid: <1557659178.71.0.414757697263.issue36893@roundup.psfhosted.org>
2019-05-12 11:06:18dracoslinkissue36893 messages
2019-05-12 11:06:18dracoscreate