Author elenril
Recipients barry, elenril, r.david.murray
Date 2019-12-19.19:32:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
When parsing a (broken) mail from (message-id, headers attached) with email.policy.SMTP, I get an AttributeError on trying to read the 'to' header:

/usr/lib/python3.7/email/ in <listcomp>(.0)
    345                                              mb.local_part or '',
    346                                              mb.domain or '')
--> 347                                      for mb in addr.all_mailboxes]))
    348             defects = list(address_list.all_defects)
    349         else:

AttributeError: 'Group' object has no attribute 'local_part'

The header in question is:
To:     unlisted-recipients:; (no To-header on input)

The problem seems to be that mb is a Group and not an Address, gets token_type of 'invalid-mailbox', but does not have the attributes local_part/domain that are expected in mailboxes. Copying the line

local_part = domain = route = addr_spec = display_name

from InvalidMailbox to Group fixes this, but it is not clear to me this is the right solution, so not sending a patch.
Date User Action Args
2019-12-19 19:32:14elenrilsetrecipients: + elenril, barry, r.david.murray
2019-12-19 19:32:14elenrilsetmessageid: <>
2019-12-19 19:32:14elenrillinkissue39100 messages
2019-12-19 19:32:14elenrilcreate