procmail
[Top] [All Lists]

Re: egreping body for 'signoff'

1996-08-21 18:05:05
I'm a little puzzled about what is probably a simple thing,
but nothing I've tried works.

I would like to discard any message that contains a certain
name anywhere in the header or body of the message.

Can someone please show me that?

Sure.  If you wanted to discard any mail which contains my name, just
for example, the following recipe should work nicely:

    :0
    * Alan *Stebbens
    { HOST }

This will silently drop any mail with my name in it, and not even log it.

**** Note to the Author of Procmail: Stephen R. van den Berg:

   Why don't you create an alias for the HOST variable, call it "QUIT",
   and document it by saying: "if the QUIT variable is set to anything
   but the current hostname, then procmail will stop processing
   instantly." This usage makes much more intuitive sense.

   I've been twice mystified because I have the habit of setting
   variables to match their usage; eg:

    FROM=`formail -rtzxTo`
    USER=`echo $FROM | cut -d@ -f1`
    HOST=`echo $FROM | cut -d@ -f2`

   And then spend more than few minutes wondering why my recipe
   mysteriously fails, until I remember to never, ever set HOST unless
   I want to instantly *quit* procmail.

**** End of Note ****

Continuing on...

If you wish to keep a log of such discard mail:

    :0
    * Alan *Stebbens
    /dev/null

which will "save" the mail to /dev/null, and enter a log abstract in
your $LOGFILE, if any.

If you wish to be able to have a conversation about me, but discard
any mail *from* me, use a recipe like this:

    :0
    * ^From: *(Alan *Stebbens|stebbens(_at_)sgi\(_dot_)com)
    { HOST }

this will silently drop mail *from* me, but not mail about me.  If my
mail is sent indirectly, using sendmail without proper headers, then
you may wish to change the "^From" into a more general set of headers:

    :0
    * ^((From|Sender|Reply-To|Apparently-To):|From ) 
*(stebbens(_at_)sgi\(_dot_)com|Alan.*Stebbens)
    /dev/null

The above recipe will catch mail with my address or name on *any* of
the following headers:

    From 
    From: 
    Sender: 
    Reply-To:
    Apparently-To:

Hope this helps as a starter.

G'luck.
_____________________________________________________________________
Alan Stebbens <stebbens(_at_)sgi(_dot_)com>      http://reality.sgi.com/stebbens

<Prev in Thread] Current Thread [Next in Thread>