Message163266
Here is the test script:
--------------
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email import encoders
msg = MIMEMultipart()
msg['Subject'] = 'Bug test'
text_part = MIMEText('actual content doesnt matter')
text_part.set_charset('utf-8')
msg.attach(text_part)
xml_part = MIMEText(b'<xml>aaa</xml>')
xml_part.set_type('text/xml')
xml_part.set_charset('utf-8')
encoders.encode_base64(xml_part)
msg.attach(xml_part)
print(msg.as_string())
--------------------------
It prints the following:
--------------------------
Content-Type: multipart/mixed; boundary="===============2584752675366770986=="
MIME-Version: 1.0
Subject: Bug test
--===============2584752675366770986==
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="utf-8"
actual content doesnt matter
--===============2584752675366770986==
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
Content-Type: text/xml; charset="utf-8"
Content-Transfer-Encoding: base64
PHhtbD5hYWE8L3htbD4=
--===============2584752675366770986==--
--------------------------
And that's incorrect: the header "Content-Transfer-Encoding" set twice. As workaround you can use:
del xml_part['Content-Transfer-Encoding'] |
|
Date |
User |
Action |
Args |
2012-06-20 10:38:32 | cancel | set | recipients:
+ cancel, barry, r.david.murray |
2012-06-20 10:38:31 | cancel | set | messageid: <1340188711.86.0.286169814605.issue15115@psf.upfronthosting.co.za> |
2012-06-20 10:38:31 | cancel | link | issue15115 messages |
2012-06-20 10:38:30 | cancel | create | |
|