[issue31820] Calling email.message.set_payload twice produces an invalid eml

Zirak report at bugs.python.org
Thu Oct 19 17:55:03 EDT 2017


Zirak <zirakertan at gmail.com> added the comment:

On irc, bitmancer suggested that this problem is already solved by the
email.message.EmailMessage class, as it is:


In [119]: m = email.message.EmailMessage()

In [120]: m.set_content('abc', 'utf8', cte='base64')

In [121]: m.get_payload()
Out[121]: 'YWJjCg==\n'

In [122]: m.set_content('abc', 'utf8', cte='base64')

In [123]: m.get_payload()
Out[123]: 'YWJjCg==\n'

In [124]: m.get_payload(decode=True)
Out[124]: b'abc\n'

In [125]: print(m)
MIME-Version: 1.0
Content-Type: text/utf8; charset="utf-8"
Content-Transfer-Encoding: base64

YWJjCg==


Because this isn't a critical bug and `email.message.Message` is quite
deprecated, and this is solved by a newer API, this bug may not need
addressing.

----------
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

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


More information about the Python-bugs-list mailing list