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 r.david.murray
Recipients barry, r.david.murray, tom de wulf
Date 2017-11-17.14:07:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1510927631.94.0.213398074469.issue32058@psf.upfronthosting.co.za>
In-reply-to
Content
parseaddr is for parsing the contents of an address header, not for parsing any additional text.  So the correct way to call it is parseaddress('someone <some@email.address>').

In any case, please look in to the new email policies, which provide a much more convenient API:

    >>> from email import message_from_bytes
    >>> from email.policy import default
    >>> m = message_from_bytes(b'Subject: I am a bug [Random]\r\nFrom: someone <some@email.address>\r\n\r\n', policy=default)
    >>> m['from']
    'someone <some@email.address>'
    >>> m['from'].addresses
    (Address(display_name='someone', username='some', domain='email.address'),)
    >>> m['from'].addresses[0].display_name
    'someone'
    >>> m['from'].addresses[0].username
    'some'
    >>> m['from'].addresses[0].addr_spec
    'some@email.address'
History
Date User Action Args
2017-11-17 14:07:11r.david.murraysetrecipients: + r.david.murray, barry, tom de wulf
2017-11-17 14:07:11r.david.murraysetmessageid: <1510927631.94.0.213398074469.issue32058@psf.upfronthosting.co.za>
2017-11-17 14:07:11r.david.murraylinkissue32058 messages
2017-11-17 14:07:11r.david.murraycreate