[issue39100] email.policy.SMTP throws AttributeError on invalid header

Anton Khirnov report at bugs.python.org
Wed Jul 7 04:11:59 EDT 2021


Anton Khirnov <anton at khirnov.net> added the comment:

Quoting R. David Murray (2021-07-06 18:59:56)
> How are you encountering this error?  The following program runs without exception for me on master:
> 
> from email import message_from_binary_file
> from email.policy import SMTP
> 
> msg = message_from_binary_file(open('mail.eml', 'rb'), policy=SMTP)
> print(msg)

The exception is thrown on accessing the 'to' header, so make that
print(msg['to'])

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39100>
_______________________________________


More information about the Python-bugs-list mailing list