Hi,
Thanks Mark, exactly what I need to replace with the multipart/related
in python!
Le 18/04/2014 22:30, Mark Sapiro a écrit :
This stuff ----------------
clip = MIMEText(attach_clip)
clip.add_header('Content-Disposition', 'inline')
clip.add_header('Content-ID', '<part1.%d>' % 123412)
clip['Content-Transfer-Encoding'] = 'base64'
del clip['Content-type']
del clip['Content-transfer-encoding']
clip['Content-type'] = 'image/png;
name="attachment-24.png"'
clip['Content-transfer-encoding'] = 'base64'
should be ---------------
clip = MIMEImage(xxx, 'png')
Yeah, I know. But I've embedded the base64 txt data of the clip image in
the handler.py's code.
So I don't need to manage an external file for the clip. Could MIMEImage
handle internal data as well?
It seems extra effort, to mime64 decode and let MIMEImage reencode it,
right?
Oh, great! That exactly the following code I was fighting with.
I've seen some code like that in Handlers/MimeDel.py, thanks a lot. I
wasn't able to adapt this recursive behavior.
def fix_msg(msg):
if msg.is_multipart():
parts = msg.get_payload()
# remove the next level parts, then process and reattach them
msg.set_payload(None)
for p in parts:
msg.attach(fix_msg(p))
return msg
else:
# process the 'leaf' parts [truncated …]
ctype = msg.get_content_type()
if ctype == 'text/plain' and not part['X-Mailman-Part']:
return msg
elif ctype == 'text/html':
return related
_______________________________________________
Mailman-Developers mailing list
[email protected]
https://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives:
http://www.mail-archive.com/mailman-developers%40python.org/
Unsubscribe:
https://mail.python.org/mailman/options/mailman-developers/archive%40jab.org
Security Policy: http://wiki.list.org/x/QIA9