I'm parsing mailbox files with Python and stumbled upon a strange behvior when trying to get all "To:" headers with get_all()
:
tos = message.get_all('to', [])
if tos:
tos = getaddresses(tos)
for to in tos:
receiver = EmailInformant()
receiver_email = to[1]
get_all()
gets all "to:" values, which are separated by commas, afaik. getaddresses
then splits the single receivers in a name and an email value.
For the following "To:" header, it does not work as I would expect:
To: example@test.de <example@test.de>
Here, the email address is provided as name and email value, but the parser treats this as two separate "To:" entries, running the for-loop twice. Is this a bug?