[Mailman-Users] Personalization in the original email
fmpage at free.fr
fmpage at free.fr
Tue Mar 28 12:29:39 CEST 2006
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.
More information about the Mailman-Users
mailing list