Coerce posts to plain text.

Bug #266543 reported by Dairiki-users on 2001-04-05
Affects Status Importance Assigned to Milestone
GNU Mailman

Bug Description

This patch adds the ability to have all posts
to a mailing list forced into a MIME text/plain

Many mailing lists have a charter which forbids
binary and HTML posts to the list. This patch
allows such a charter to be enforced is a
maximally transparent manner.

The feature is configurable on a per-list basis.
If enabled, all posts to the list are run through a
filter which:

  Squashes multipart messages into a single
flat message (it picks the most plain-text-like
alternative from multipart/alternative entities.)

  Converts 'text/html', 'text/enriched', and
'text/richtext' entities to 'text/plain'.

  Deletes cruft headers from content of type

  Deletes any uuencoded files from 'text/plain'

  Entities of any other types are assumed to
be binary attachements are are deleted.

This patch is on mailman-2.0.3.


Dairiki-users (dairiki-users) wrote :
Dairiki-users (dairiki-users) wrote :

I've just made a minor change:

HTML converted to plain-text now includes a list of links at
the end of
the message.

Other attachments

Dairiki-users (dairiki-users) wrote :

Fixed bug (reported by Pug Bainter <email address hidden> -- thanks!)

New patches, on mailman-2.0.5 uploaded (below).

The only real change is:

--- 0.5/Mailman/ Wed, 04 Apr 2001
10:04:36 -0700 dairiki (mailman/k/4_FilteringM 1.2 664)
+++ 0.8(w)/Mailman/ Mon, 07 May 2001
09:05:18 -0700 dairiki (mailman/k/4_FilteringM 1.3 664)
@@ -185,8 +185,12 @@
             pname, pval = string.split(param, '=', 1)
             return (string.lower(pname),

- return map(split_param, message.getplist())
+ def valid_param(param):
+ return '=' in param
+ # Trailing ;'s in content-type yield empty strings
from getplist().
+ return map(split_param,
+ filter(valid_param, message.getplist()))

     def discards_data(fp):
         """Determine whether file object ignores data
written to it.

Bug Importer (bug-importer) wrote :

For *some* reason when I apply the patch (the newest one)
to my freshly downloaded version of Mailman 2.0.5 and
compile and install mail never reaches the list. I've
tried without the patch and everything works fine...
perhaps I'm patching wrong? I'm just saying:

patch < name_of_patch

It makes me fix a few paths to some of the files, but
that's it... :-/ Any help would be appriciated!

Dairiki-users (dairiki-users) wrote :

Here's a rough outline of how to proceed:

1. Start by unpacking a fresh copy of mailman-2.0.5.tgz
2. Change into the top source directory (which was created
in the previous step.
3. Try applying my patches with:
     patch -p1 <
(that's "dash pee one")
That should work --- you should not get any warnings or
prompts from patch. If you do, something is fishy.
4. Run ./configure and 'make install' as usual (read
mailman's INSTALL for instructions on this.)

Feel free to write me at <email address hidden>.

Dairiki-users (dairiki-users) wrote :

If you don't want to mess with patching the source, I've
also attached (below) a tarball of the mailman-2.0.5 source
with my patches already applied.

Dairiki-users (dairiki-users) wrote :

Disregard last. (Apparently one can't attache files bigger
than 256 kb.)

Mailman-2.0.5 with plaintext patches applied can be found
(for a limited time) at:

Dairiki-users (dairiki-users) wrote :

Another minor bugfix: it turns out pythons mimetools doesn't
treat the content-transfer-encoding is a case insensitive
fashion --- so now we smash the case ourself.

A new patch set on mailman-2.0.5 is available on this page.
Pre-patched mailman source code can be found at:

Dairiki-users (dairiki-users) wrote :

More fixes:

* Mailman/ Handle 'content-type:
multipart' (no subtype) gracefully.

* Mailman/Handlers/ Catch exceptions (fatal
errors) from plaintext filter. When exception is caught,
an error is logged, but the message is passed on
unfiltered. (A diagnostic message is added to the message
headers.) This should make it so little piddly bugs in the
filter will get noticed, but at the same time will not cause
messages to get stuck in the queue.

Patches from mailman-2.0.5 are available from this page and
are also at:

Pre-patched mailman-2.0.5 source code is at:

Bug Importer (bug-importer) wrote :

After applying this patch to 2.0.5, I found that I had to
add this line manually to my existing config file


If this line is not added, any web requests and any
messages posted will produce an error "AttributeError :

Not sure if I did something wrong or if this is normal, but
I wanted to advise others just in case

Dairiki-users (dairiki-users) wrote :

More fixes:

* Mailman/
   Change Message-ID: of filtered messages.

* Mailman/pythonlib/
   Fix obscure but occasionally fatal bug.

The first fix is very minor. The second fix fixes
a bug which caused the plaintext filter to fail

Diffs from mailman-2.0.6 are available from this page and
are also at:

Pre-patched mailman-2.0.6 source code is at:

Dairiki-users (dairiki-users) wrote :

More fixes.

* Mailman/
    Fixes for bugs in python 1.5.2's quopri library module.

The plaintext patches are at version 0.14.
Look for the patches on Mailman 2.0.6, as well as a complete
tarball of patched Mailman 2.0.6 code at

Patches on 2.0.6 are also attached to this page.

Dairiki-users (dairiki-users) wrote :

Another bug fix.

  Lines which contain nothing but the word 'end'
mysteriously dissapear. (Reported by David Gibbs.)

The only changed file in Mailman/,
I've attached the latest version of that file to this page.

As usual, patches on mailman 2.0.8 are also attached.

Diffs and a patched Mailman-2.0.8 tarball are at

This patch seems to leave any preamble above the first part
of a multipart message intact. Many mailers put blurb such
as "This is a MIME-encoded message; you will need a MIME-
aware mail client to see all of this message." here, which
it makes no sense to reproduce after the mail has be
coerced into plaintext.

Looks like it's easy enough to change this behaviour by
commenting out the line

           mimetools.copybinary(infp, outfp) # copy preamble

from Mailman/

Barry Warsaw (barry) wrote :

Since this patch is against 2.0.x and since MM2.1 provides
support for stuff like this, I'm inclined to close this
patch. I'd be willing to add a link to this from the
unofficial patches wiki. What do you think?

Dairiki-users (dairiki-users) wrote :

I don't have strong feelings, but my druthers would be to
wait until 2.1 is officially designated "stable".

A link from the wiki would be great!
(There is/was already a link from the FAQ.)

Jozeph (jozeph) wrote :

Hello dairiki... do you have this patch for Mailman-2.0.13 ?

Bug Importer (bug-importer) wrote :

Hi Dairiki,

It's me... I added your patch in my latest version and it's
running OK... you can post the patch here! :)

Dairiki-users (dairiki-users) wrote :

It seems the patches continue to work (basically unchanged)
for Mailman-2.0.13.

Updated patches are attached below.

The patches as well as a pre-patched Mailman-2.0.13 tarball
are at

Barry Warsaw (barry) wrote :

BTW, I've finally added that link from the wiki to this patch.

Bug Importer (bug-importer) wrote :

I'm new to Mailman. I don't understand why you don't have a
patch for the current version of Mailman, 2.0.10. Can I apply
an earlier patch safely?

Dairiki-users (dairiki-users) wrote :

Enh? The current version of Mailman is 2.0.13.
That said, the latest patch set (named
mailman-2.0.13-plaintext-0.17.patch, and attached below)
will work fine, I think, for Mailmain versions 2.0.x back to
at least 2.0.8, and probably earlier.

Feel free to e-mail me privately for more help.
<email address hidden>

Dairiki-users (dairiki-users) wrote :

Note also that the recent patch sets also incorporate patch
#415448 [1]: a minor patch so that Mailman recognizes bounce
messages from ("Sun Internet Mail Server").

This patch inadvertently slipped in, but it does no harm.
If you don't like it just delete the patches to


Jozeph (jozeph) wrote :

Hey dairiki, please... look at
I don't know if the problem is plaintext bug! :(

Ppsys (ppsys) wrote :

I encountered some problems with upgrading from MM 2.0.13
to MM 2.1b5 as a consequence of having installed this patch
on our existing system.


for details of the symptoms and the solution that worked for

Thomas Wouters (thomas) wrote :

I think we can call Mailman 2.1 sufficiently stable now to
close this patch. There should still be a link on the
unofficial-patches wiki -- except that I can't find the wiki
:-) Barry ?

Thomas Wouters (thomas) wrote :

I created a seperate 'unofficial 2.0 patch' category, so the
patches are more easily found. We could also mark the patch
as 'pending' to stop it from showing up under the regular
patches overview.

Barry Warsaw (barry) wrote :

Here's the wiki for MM2.0 unofficial patches.

dairiki's patch is already there so I think we can close
this report now.

Barry Warsaw (barry) wrote :

+1 on the category. Unfortunately, if you set status to
pending, and there are no responses within 14 days it moves
to deleted status. Apparently we can't add new stati or
resoluti so I'll leave it as Closed/None.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.