Where in the code is the message footer added?

Hello all,
Some of the users at my site send/post their messages in HTML format. As we know Mailman does its best to add the list's message footer. At our site (with HTML formatted messages), the footer usually appears as an attachment (generally called Part.002 or Part.003, etc.). The message footer contains the url on how to unsubscribe. However, our users cannot seem to find the footer in one of the attachments. They think the 'Part.002' is just gibberish and don't look at it. Training/educating the users is not an option since we already do that and our users seem to be determined not to remember or understand.
What I would like to do is give the message footer attachment a name. That way instead of seeing 'Part.002', the users will see 'Unsubscribe'. Maybe that will help, maybe not but it is one more step to make it a little more visible for the users. I am guessing I can use 'Content-filename: <name>' to give the attachment and name. The question is where in the code do I add the change?
Thanks, Chris

On Fri, Apr 20, 2012 at 7:03 PM, C Nulk <CNulk@scu.edu> wrote:
We just resolved this pretty well with Mark's help. Here are my notes for how we fixed it. The full discussion took place in recent days, so if you are just now joining the list, check this week's archives.
Supporting HTML email with correct footers:
Is text/html in the pass_mime_types content filtering setting?
Is collapse_alternatives set to No?
I suspect that one or both of those is not the case, and setting them will solve your problem.
I further suspect that collapse_alternatives is the issue. Gmail creates a multi-part alternative message with a text/plain alternative containing Gmail's conversion of the HTML and a text/html alternative containing the HTML.
If collapse_alternatives is Yes, Mailman simply replaces the multipart/alternative part with the first (i.e.text/plain) alternative.
See the FAQ at <http://wiki.list.org/x/84A9> for a more complete discussion.

C Nulk wrote:
There's no such header as Content-Filename:.
If you want to do this by hacking code, look at Mailman/Handlers/Decorate.py.
You will find two places in the code which look like
if footer:
mimeftr = MIMEText(footer, 'plain', lcset)
mimeftr['Content-Disposition'] = 'inline'
payload.append(mimeftr)
That's the first. The second looks the same but is indented 4 spaces less. There are also similar "if header:" blocks, but presumably you aren't interested in those.
Now as to what to do, that's a bit tricky because parts aren't expected to have names unless they are attachments, not inline, but changing the Content-Disposition: to 'attachment' will likely break the inline display in those MUAs that do it right.
So I suggest an experiment.
change
mimeftr['Content-Disposition'] = 'inline'
to
mimeftr['Content-Disposition'] = 'inline; filename="List Unsub.txt"'
but indented as the original in both places.
You could also add another line indented at the same level as the above line
mimeftr.set_param('name', 'List Unsub.txt')
to set the name= parameter on the Content-Type: header. See <http://en.wikipedia.org/wiki/MIME#Content-Disposition> for example for why you might do both. Note that this article says using a name= parameter on Content-Type: INSTEAD of a filename= on Content-Disposition: is discouraged, but you would be doing both which is different. Besides, by definition you are dealing with a broken MUA if it doesn't display the 'inline' parts in line, so give it all the help you can.
Of course, the name "List Unsub.txt" can be whatever you want, but a .txt extension is a good idea.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan

On Fri, Apr 20, 2012 at 7:03 PM, C Nulk <CNulk@scu.edu> wrote:
We just resolved this pretty well with Mark's help. Here are my notes for how we fixed it. The full discussion took place in recent days, so if you are just now joining the list, check this week's archives.
Supporting HTML email with correct footers:
Is text/html in the pass_mime_types content filtering setting?
Is collapse_alternatives set to No?
I suspect that one or both of those is not the case, and setting them will solve your problem.
I further suspect that collapse_alternatives is the issue. Gmail creates a multi-part alternative message with a text/plain alternative containing Gmail's conversion of the HTML and a text/html alternative containing the HTML.
If collapse_alternatives is Yes, Mailman simply replaces the multipart/alternative part with the first (i.e.text/plain) alternative.
See the FAQ at <http://wiki.list.org/x/84A9> for a more complete discussion.

C Nulk wrote:
There's no such header as Content-Filename:.
If you want to do this by hacking code, look at Mailman/Handlers/Decorate.py.
You will find two places in the code which look like
if footer:
mimeftr = MIMEText(footer, 'plain', lcset)
mimeftr['Content-Disposition'] = 'inline'
payload.append(mimeftr)
That's the first. The second looks the same but is indented 4 spaces less. There are also similar "if header:" blocks, but presumably you aren't interested in those.
Now as to what to do, that's a bit tricky because parts aren't expected to have names unless they are attachments, not inline, but changing the Content-Disposition: to 'attachment' will likely break the inline display in those MUAs that do it right.
So I suggest an experiment.
change
mimeftr['Content-Disposition'] = 'inline'
to
mimeftr['Content-Disposition'] = 'inline; filename="List Unsub.txt"'
but indented as the original in both places.
You could also add another line indented at the same level as the above line
mimeftr.set_param('name', 'List Unsub.txt')
to set the name= parameter on the Content-Type: header. See <http://en.wikipedia.org/wiki/MIME#Content-Disposition> for example for why you might do both. Note that this article says using a name= parameter on Content-Type: INSTEAD of a filename= on Content-Disposition: is discouraged, but you would be doing both which is different. Besides, by definition you are dealing with a broken MUA if it doesn't display the 'inline' parts in line, so give it all the help you can.
Of course, the name "List Unsub.txt" can be whatever you want, but a .txt extension is a good idea.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (3)
-
C Nulk
-
David
-
Mark Sapiro