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 rdemetrescu
Recipients ThomasAH, barry, rdemetrescu
Date 2007-12-06.16:53:41
SpamBayes Score 0.0087805595
Marked as misclassified No
Message-id <1196960022.46.0.752691873968.issue1525919@psf.upfronthosting.co.za>
In-reply-to
Content
I am not sure if it is related, but anyway...

MIMEText behaviour has changed from python 2.4 to 2.5.


# Python 2.4

>>> from email.MIMEText import MIMEText
>>> m = MIMEText(None, 'html', 'iso-8859-1')
>>> m.set_payload('abc ' * 50)
>>> print m
From nobody Thu Dec  6 12:52:40 2007
Content-Type: text/html; charset="iso-8859-1"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc=
 abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc ab=
c abc abc abc abc abc abc abc abc abc abc abc abc=20








# Python 2.5

>>> from email.MIMEText import MIMEText
>>> m = MIMEText(None, 'html', 'iso-8859-1')
>>> m.set_payload('abc ' * 50)
>>> print m
From nobody Thu Dec  6 14:46:07 2007
Content-Type: text/html; charset="iso-8859-1"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc
abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc
abc abc abc abc abc abc abc abc abc abc abc abc abc abc





However, if we initialize MIMEText with the text, we get the correct output:

# python 2.5

>>> from email.MIMEText import MIMEText
>>> m = MIMEText('abc ' * 50, 'html', 'iso-8859-1')
>>> print m
From nobody Thu Dec  6 13:01:17 2007
Content-Type: text/html; charset="iso-8859-1"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc=
 abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc ab=
c abc abc abc abc abc abc abc abc abc abc abc abc=20



If I want to set payload after MIMEText is already created, I need to
use this workaround::

#python 2.5
from email.MIMEText import MIMEText
m = MIMEText(None, 'html', 'iso-8859-1')
m.set_payload(m._charset.body_encode('abc' * 50))


PS: The issue's versions field is filled with "Python 2.4". Shouldn't it
be "Python 2.5" ?
History
Date User Action Args
2007-12-06 16:53:42rdemetrescusetspambayes_score: 0.00878056 -> 0.0087805595
recipients: + rdemetrescu, barry, ThomasAH
2007-12-06 16:53:42rdemetrescusetspambayes_score: 0.00878056 -> 0.00878056
messageid: <1196960022.46.0.752691873968.issue1525919@psf.upfronthosting.co.za>
2007-12-06 16:53:42rdemetresculinkissue1525919 messages
2007-12-06 16:53:41rdemetrescucreate