[Mailman-Users] Throwing away Implicit messages rather than holding them

Jon Carnes jonc at haht.com
Sat Oct 20 02:31:17 CEST 2001


This seems like an interesting thing to do...

Looking into dumping that implicit mail instead of letting it pile up it
seems a bit more complex than editing the SpamDetect.py module.
Mailman runs mail through the following pipeline of modules (in order):
  'SpamDetect',
  'Approve',
  'Replybot',
  'Hold',
  'Cleanse',
  'CookHeaders',
  'ToDigest',
  'ToArchive',
  'ToUsenet',
  'CalcRecips',
  'Decorate',
  mm_cfg.DELIVERY_MODULE
  'AfterDelivery',
  'Acknowledge',

SpamDetect is the only module that actually throws out a message and its the
first module to be run.  It is a simple RegEx compare of items in the Known
Spammers field in the configuration.

Hold is the module that checks for explicit vs implicit destination (and
whether or not you allow it).  The bit of code from that module that tells
it hold the message is:
===
  #
   # implicit destination?  Note that message originating from the Usenet
   # side of the world should never be implicitly destined
   if mlist.require_explicit_destination and \
      not mlist.HasExplicitDest(msg) and \
      not msgdata.get('fromusenet'):
       # then
       hold_for_approval(mlist, msg, msgdata, ImplicitDestination)
       # no return
===

The relavent code in the SpamDetect module that tells Mailman to throw away
the message is:

     mo = cre.search(text)
     if mo:
         # we've detected spam, so throw the message away
         raise SpamDetected

Where the class "SpamDetected" is defined:

  class SpamDetected(HandlerAPI.DiscardMessage):
      """The message contains known spam"""

===

Not an Expert here, but we might be able to load this class into the Hold
module and then substitute:
     raise SpamDetected
for the line:
      hold_for_approval(mlist, msg, msgdata, ImplicitDestination)

Should be fun to try.  If it works I'll let you know... Though I won't be
able to try till Monday!

Jon Carnes

BTW: I'll be glad to hear from anyone else who has already done this!

----- Original Message -----
From: "Dan Mick" <dmick at utopia.West.Sun.COM>
To: <mavery at mail.otherwhen.com>; <arandall at auntminnie.com>
Cc: <mailman-users at python.org>
Sent: Thursday, October 18, 2001 7:52 PM
Subject: Re: [Mailman-Users] Just drop it?


> One can do a very small amount of hacking to
Mailman/Handlers/SpamDetect.py
> and accomplish the "drop without further notice" action.  It's
> been useful for spammers for me.
>
> Basically, you just add to the list in the file; the comments
> are pretty readable; take a look and see what you think.
>
> > Hi Mike,
> >
> > I believe you can specify to *not* send mail to the moderator when
> > receiving a message to the list that would require approval. That will
> > at least help her mailbox... but it will still queue the messages in
> > the admin interface. ::sigh::
> >
> > As far as silently discarding the messages, well, that seems to be a
> > very popular question. :-) I don't think Mailman itself has any way to
> > deal with that... next solution I suppose would be something in the
> > MTA or something between the MTA and mailman, which would bitbucket
> > mail unless it came from the moderator's email address. ::shrug::
> > There are probably a number of ways to do it, but it's going to be a
> > matter of how much effort you want to put into it.
> >
> > =)
> > Amanda
> >
> >
> > Mike Avery wrote:
> >
> > > One of my moderators asked me for help.  She runs a
> > > moderated list, and only wants her messages to go to
> > > the list.
> > >
> > > We've done that.
> > >
> > > What is bothering her now is she gets a note every time
> > > a spammer tries to hit this list.  She doesn't want to
> > > know about it, and she doesn't want to have to manually
> > > discard every one of the spam attempts.
> > >
> > > She wants Mailman to just drop the message into a
> > > black hole, without telling anyone it happened.
> > >
> > > I don't see a way to do that.... am I overlooking
> > > something?
> > >
> > > Thanks,
> > > Mike--
> > > Mike Avery
> > > MAvery at mail.otherwhen.com






More information about the Mailman-Users mailing list