mailman_mimedefang_fix_footer - mimedefang filter code for moving a mailman footer from a separate attachment into the text and HTML body parts of the message.


GNU Mailman is the most popular free software package for managing electronic mailing lists. While it is quite good at what it does, there is one functional deficiency that people stumble over frequently: it doesn't handle message footers well for multipart MIME messages.

Nowadays, most mail programs generate email messages containing both text and HTML versions of their content. When a Mailman list is configured to append a footer to outgoing messages and it encounters a message with both text and HTML content versions, it adds the footer as a separate section of the message entirely. Some mail programs display the resulting footer properly, but others do not, with the result that users may not see the footer as desired by the list administrators. This problem is discussed in the Mailman FAQ at, which essentially says that the maintainers of Mailman consider this problem to be unsolveable.

Not everyone is convinced, and some of the dissenters have put their money where their mouth is. For example, see, which describes enhancements to Mailman implemented at one site to allow separate text and HTML headers to be configured and appended directly to the text and HTML content versions of outgoing messages. Unfortunately, the maintainers of Mailman rejected these enhancements, and they are obsolete, i.e., incompatible with the current stable version of Mailman.

Others have pointed out that the popular mimedefang free software package also knows how to add footers to text and HTML message parts, so if mimedefang can do it, then Mailman should be able to as well.

It is also frequently mentioned that mimedefang can be used in conjunction with Mailman to implement a workaround for this problem, but it is not straightforward, and it seems like no one who mentions this solution ever explains exactly how to do it. Until now, that is... This script can be used to embed Mailman message footers directly in the text and HTML content versions of your outgoing messages. It does not require any code changes to Mailman; it can used with standard versions of Mailman and mimedefang. Read on to find out exactly how.


Usage is simple:

1. Install and configure Mailman (consult Mailman documentation for details).
2. Install and configure mimedefang normally (consult mimedefang documentation for details). This script is tested with mimedefang version 2.70.
3. Add the code below (everything after "=cut") at the end of /etc/mail/mimedefang-filter, or wherever the mimedefang filter script lives on your system, right before the final "1;".
4. Add "&mailman_footer_munge($entity);" to the filter_end function, right after "return if message_rejected();".
5. For the Mailman lists for which you want to use this, change the "msg_footer" setting on the "Non-digest options" configuration page so that it starts and ends with a line containing only "MAILMAN_MIMEDEFANG". That is, add lines containing that string to the beginning and end of the setting, in addition to the footer text that's already there. If you don't want any footer at all, just put two "MAILMAN_MIMEDEFANG" lines, one right after the other, in the header.
6. Reload your mimedefang configuration.
7. Send an email message and check your mail syslog to make sure you didn't introduce a syntax error which is breaking mail delivery.

That's it! The footers generated by Mailman for outgoing messages to the lists you've reconfigured will now be detected by mimedefang and moved into the text and HTML body parts of the messages.

Word wrapping

If you want the text version of the footer to be word-wrapped automatically, put a space and then "WRAP" on the first line of the footer, after "MAILMAN_MIMEDEFANG".

Fixed-width HTML

If you want the HTML version of the footer to be displayed in a fixed-width font, put a space and then "FIXED_WIDTH" on the first line of the footer, after "MAILMAN_MIMEDEFANG".

You can do "MAILMAN_MIMEDEFANG WRAP FIXED_WIDTH" to get both of these features.


Copyright (c) 2010-2011 Jonathan Kamens.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.



I love to hear from people who are using my software, so please email me <> and let me know! Please also email me if you have any questions, suggestions, bug reports, fixes or enhancements to share.

This is version $Revision: 1.2 $ of this script. The current version can always be downloaded from This Documentation is available on-line at


December 14, 2011 -- Clarify how to format the footer setting in the mailman list configuration. Update the copyright to include 2011. Update the link to my email address in the documentation.
December 6, 2011 -- Clarify in the documentation where exactly to add the code to filter_end.
November 4, 2011 -- If the message is multipart and has only one part, then work with that one part rather than with the entire message. This is necessary became mimedefang has a nasty habit of turning text/plain messages into multipart/mixed messages.
June 14, 2010 -- Fixed to properly handle mailing list messages with attachments.
May 24, 2010 -- Initial release