[Mailman-Users] changing rejected post messages to not include allof the original text

Mark Sapiro msapiro at value.net
Sun Mar 19 00:20:23 CET 2006


Elizabeth Lear wrote:
>
>The SORBS rep said "If you are able to change the configuration of the
>mailing lists so that the rejection notices would not contain the
>contents of the rejected message, it should be sufficient to cause this
>not to happen again."  Is there a way that I could change this setting
>in mailman?


There is currently no setting for this in Mailman.

One way to do this is to implement spam filtering on the incoming mail
in the MTA before it ever reaches Mailman and reject spam at the SMTP
level.

It can be done in Mailman by modifying the code in Mailman/Bouncer.py.
At the end of the definition of the BounceMessage() method is the
following (watch for wrapped lines)

        # Currently we always craft bounces as MIME messages.
        bmsg = Message.UserNotification(msg.get_sender(),
                                        self.GetOwnerEmail(),
                                        subject,
                                        lang=self.preferred_language)
        # BAW: Be sure you set the type before trying to attach, or
you'll get
        # a MultipartConversionError.
        bmsg.set_type('multipart/mixed')
        txt = MIMEText(notice,
                      
_charset=Utils.GetCharSet(self.preferred_language))
        bmsg.attach(txt)
        bmsg.attach(MIMEMessage(msg))
        bmsg.send(self)

If you simply remove the line

        bmsg.attach(MIMEMessage(msg))

or change it to

        # bmsg.attach(MIMEMessage(msg))

the reject email will still be a MIME multipart/mixed message with one
text/plain subpart containing the reject notice.

If you want a simple text/plain message, make the above look like

        bmsg = Message.UserNotification(msg.get_sender(),
                                        self.GetOwnerEmail(),
                                        subject,
                                        lang=self.preferred_language)
        bmsg.set_payload(notice,
                       Utils.GetCharSet(self.preferred_language))
        bmsg.send(self)

 
-- 
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