procmail
[Top] [All Lists]

Re: spamchecking and multiple bypass lists

1997-07-05 13:44:00
Timothy Luoma wrote,

| I've got 4 lists which I use to sort mail, and I want to use them to bypass  
| my spam checking RC, and this works:
| 
| :0
| * ! ? $FGREP -i ${REPLYTO}  ${PROCDIR}/spambypass.txt
| * ! ? $FGREP -i ${REPLYTO}  ${PROCDIR}/known-users/NeXT-Users.txt
| * ! ? $FGREP -i ${REPLYTO}  ${PROCDIR}/known-users/zsh-users.txt
| * ! ? $FGREP -i ${REPLYTO}  ${PROCDIR}/known-users/peak-users.txt
| { INCLUDERC=$PROCDIR/rcfiles/spam-check.rc }
| 
| However, I want to have an 'else' for the above, ie if they are in any of  
| those lists, then do this:

Well, first thing is that if you want to test for "any" versus "none" instead
of "all" versus "not every one", you can condense the four fgrep calls to one
that checks all four files:

  * ! ? $FGREP -i ${REPLYTO}  ${PROCDIR}/spambypass.txt \
        ${PROCDIR}/known-users/NeXT-Users.txt \
        ${PROCDIR}/known-users/zsh-users.txt \
        ${PROCDIR}/known-users/peak-users.txt

Back to Timothy's code:

| :0E
| | $FORMAIL -I"X-SpamChecker: PASSED" -I"X-SpamNote: ByPassed"

| But the 'else' part isn't being processed, so my guess is I'm doing  
| something fundamentally wrong here....

Perhaps it *is* being processed.  It says to feed the text to formail but
not what to do with formail's output, so procmail just drops the results
contentedly to the floor.  Did you mean to have the `f' and `h' flags on
the else clause?

Actually, with the conditions reduced from four to one, we can invert it
and do this instead (and out of nervousness, I'd like to quote $REPLYTO):

  :0fh
  * ? $FGREP -i "${REPLYTO}"  ${PROCDIR}/spambypass.txt \
        ${PROCDIR}/known-users/NeXT-Users.txt \
        ${PROCDIR}/known-users/zsh-users.txt \
        ${PROCDIR}/known-users/peak-users.txt
  | $FORMAIL -I"X-SpamChecker: PASSED" -I"X-SpamNote: ByPassed"

  :0E
  { INCLUDERC=$PROCDIR/rcfiles/spam-check.rc }

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