[Mailman-Developers] modifying payload using same encoding and Content-Transfer-Encoding

Sylvain Viart sylvain at opensource-expert.com
Thu May 15 10:17:32 CEST 2014


Hi,

Le 14/05/2014 02:45, Mark Sapiro a écrit :
> It works for me. The following withlist interaction based on a 
> stripped down version of what you originally posted shows it works. 

Thanks a lot, it finally works as you said…

I was pretty sure to have tested that code already, but I should have 
missed a small part…

This code works:

             charset = msg.get_content_charset()
             old_content = msg.get_payload(decode=True)
             new_content = re.sub(r'</body>', html_footer, old_content)
             del msg['content-transfer-encoding']
             msg.set_payload(new_content, charset)


See the full code in the repository:
https://github.com/Sylvain303/mailman-AttachmentMove/blob/master/AttachmentMove.py#L352

Regards,
Sylvain.


More information about the Mailman-Developers mailing list