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 mardiros
Recipients mardiros
Date 2020-06-28.09:43:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1593337413.31.0.292797380525.issue41145@roundup.psfhosted.org>
In-reply-to
Content
I am currently refactoring code and use the EmailMessage api
to build message.

I encountered weird behavior while building an email.
The `as_string()` method is fixing the `make_alternative` method.

So, to me their is two bug here: a `as_string` method should not mutate internal state,
and the `make_alternative` should create a correct internal state.


It may be resume in the following program:


```
𝝿 python
Python 3.8.3 (default, May 17 2020, 18:15:42)
[GCC 10.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import email
>>> from email.message import EmailMessage, MIMEPart
>>>
>>> msg = EmailMessage()
>>> msg.make_alternative()
>>> print(msg.get_boundary())
None
>>> print(msg._headers)
[('Content-Type', 'multipart/alternative')]
>>> _ = msg.as_string()
>>> print(msg.get_boundary())
===============3171625413581695247==
>>> print(msg._headers)
[('Content-Type', 'multipart/alternative; boundary="===============3171625413581695247=="')]
```
History
Date User Action Args
2020-06-28 09:43:33mardirossetrecipients: + mardiros
2020-06-28 09:43:33mardirossetmessageid: <1593337413.31.0.292797380525.issue41145@roundup.psfhosted.org>
2020-06-28 09:43:33mardiroslinkissue41145 messages
2020-06-28 09:43:33mardiroscreate