procmail
[Top] [All Lists]

if then else

1998-05-03 17:32:05
Some of you may remember my recent post about getting too much mail from
certain posters on another list.  The recipe I had in mind would check
the header and body for certain strings such as my email address or
my full name, and if found, send it to the list's mailbox, else send it
to /dev/null.

Here's what I came up with experimenting on my own while borrowing heavily
from David Tamkin & Tim <bodysurf(_at_)pobox(_dot_)com>.
I've used "beautiful day" as the string while testing.

BOZOS=$MAILDIR/.scf.bozos
FROM=`formail -rzxTo:`
EGREP=/usr/local/bin/egrep
:0
* ? echo "$FROM" | $EGREP -i -f $BOZOS
{
        :0 HBbfw # capital B *and* lower-case b
        * beautiful.day
        |cat
         :0A
         scf
          :0EA
          trash
}

It works except for the else condition (I'm just a beginner at this, really).
That is, a message without the string from a named address in .scf.bozos
is not sent to the "trash" test mailbox.

The other thing that doesn't work is multiple strings.  For example,

        * "beautiful.day|summer.weather"

did not work.

All suggestions for fixes and/or improvements to the other code
would be greatly appreciated.  Thanks.

Dave Robbins

===========================================================================
===  Nuremberg Laws are in place in America ... if you're a single dad  ===
===========================================================================
===  1935 (Sep 15) Nuremberg Laws deprive German Jews of citizenship    ===
===========================================================================

<Prev in Thread] Current Thread [Next in Thread>
  • if then else, Dave Robbins <=