Hi,

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.

Fred.
------------------------------------------------------
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

Reply via email to