[EMAIL PROTECTED] wrote: > >I've been trying to get personalization working inside the body of the original >email instead of using header and footer. >I did manage to get it working in plain text and html format, by doing some >tweaking in the Decorate.py file. >However, the code I added to get it working for multipart/alternative does not >seem to work. See below: > >sMsgToFormat="" >msgtype = msg.get_content_type() > >if not msg.is_multipart(): > sMsgToFormat=msg.get_payload() > >elif msgtype == 'multipart/alternative': > sBoundary=msg.get_boundary() > part=msg.get_payload() > for val in part: > sPart=sBoundary+'\n'+val.as_string() > sMsgToFormat+=sPart > sMsgToFormat+='\n' > >#now replace substitute var that are formmated as [[variable]] >for key, val in d.iteritems(): > sMsgToFormat=string.replace(sMsgToFormat,'[['+key+']]',val) > >#set the original message with the new content >msg.set_payload(sMsgToFormat) > >The output generated seems ok when I look at the mail source on any client, but >the message does not show up at all.
First, this is probably OT for mailman-users. I suggest you take any follow ups to mailman-developers. You have probably broken the MIME structure in some way. It is not clear to me exactly how, but you are manipulating MIME parts outside of the standard methods for doing so, so it's not surprising. Why not just to something like: for part in msg.walk(): if part.get_content_maintype() == 'text': del part['content-transfer-encoding'] part.set_payload(DoReplacements( part.get_payload(decode=True))) -- Mark Sapiro <[EMAIL PROTECTED]> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan ------------------------------------------------------ Mailman-Users mailing list Mailman-Users@python.org http://mail.python.org/mailman/listinfo/mailman-users Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/ Unsubscribe: http://mail.python.org/mailman/options/mailman-users/archive%40jab.org Security Policy: http://www.python.org/cgi-bin/faqw-mm.py?req=show&file=faq01.027.htp