[Mailman-Users] Custom footer based on sender's email
Mark Sapiro
msapiro at value.net
Thu May 11 19:46:04 CEST 2006
Rob Jackson wrote:
>
>Here it is.
>
>+++ /u1/mailman/Mailman/Handlers/Decorate.py 2006-05-10
>11:36:43.000000000 -0600
>@@ -188,6 +188,12 @@
> del msg['content-disposition']
> msg['Content-Type'] = 'multipart/mixed'
>
>+ #Testing to replace footer
>+ pl = msg.get_payload(decode=True)
>+ re.sub('AZ', 'new text', pl)
>+ msg.set_payload(pl)
>+
>+
>
> def decorate(mlist, template, what, extradict={}):
Elvis has left the building...
I.e. putting the code there will only get those messages in which the
mailman header/footer has been added as a separate mime part to a
message not already multipart/mixed.
Starting from the top of Decorate.process() we have several exits:
# Escape hatch if both the footer and header are empty
if not header and not footer:
return
If there is no defined msg_header or msg_footer, we leave.
# If we couldn't add the header or footer in a less intrusive way,
we can
# at least do it by MIME encapsulation. We want to keep as much of
the
# outer chrome as possible.
if not wrap:
return
If we have managed to add the header and/or footer to a text/plain
message, or if the message was already multipart/mixed and we added
the header and/or footer as separate mime parts, we are done and leave
here.
The only thing that gets beyond here is the case where we create a new
multipart/mixed 'wrapper' with header and/or footer parts and the
original message as a message/rfc822 part.
You first have to see whether or not you have msg_header and or
msg_footer for the list, and also what the structure of the incoming
message is. In the simplest case of a single part text/plain message,
you could add the three lines just prior to
# Escape hatch if both the footer and header are empty
if not header and not footer:
return
--
Mark Sapiro <msapiro at value.net> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
More information about the Mailman-Users
mailing list