Message58248
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" ? |
|
Date |
User |
Action |
Args |
2007-12-06 16:53:42 | rdemetrescu | set | spambayes_score: 0.00878056 -> 0.00878056 recipients:
+ rdemetrescu, barry, ThomasAH |
2007-12-06 16:53:42 | rdemetrescu | set | spambayes_score: 0.00878056 -> 0.00878056 messageid: <1196960022.46.0.752691873968.issue1525919@psf.upfronthosting.co.za> |
2007-12-06 16:53:42 | rdemetrescu | link | issue1525919 messages |
2007-12-06 16:53:41 | rdemetrescu | create | |
|