I'm going to repost a message from Gary Funck that solves this
nicely. I've been running it for awhile and it works like a charm.

----------

>From [EMAIL PROTECTED] Thu May 29 08:08:49 2003
Date: Wed, 28 May 2003 20:56:10 -0700
From: Gary Funck <[EMAIL PROTECTED]>
To: SpamAssassin listserve <[EMAIL PROTECTED]>
Subject: RE: [SAtalk] whitelist


> 
> I don't suppose someone out there could tell me how to tell procmail to
> simply accept the message and stop processing?
> 

Generally, just deliver it to $DEFAULT.  Something like this (towards
the beginning of your procmailrc):

FROM=`formail -rx To: | sed -e 's/^[ ]*//'`
REALLY_FROM=`formail -x From: | sed -e 's/^[ ]*//'`

:0:
* $ ? /bin/fgrep -i -q "$FROM" $HOME/.white_list || \
  /bin/fgrep -i -q "$REALLY_FROM" $HOME/.white_list
$DEFAULT

This is not the most efficient way to do things, but shows the
basic idea.  The "$" after the "*" tells procmail to do variable
substitution for "$FROM" and "$REALLY_FROM". The "$FROM" variable
contains the address as it appears on the "From " header (note the
space, no colon), for example,
  [EMAIL PROTECTED]
The $REALLY_FROM variable contains the sender's address as it appears
on the "From:" header line (note the colon), for example, 
  "Alfred E. Newman <[EMAIL PROTECTED]>.
You can extend this to Reply-To and
other things as well. In this exapmple, $HOME/.white_list contains
white-listed addresses one per line. 

We could dress up the pattern match to make sure the matech is an exact
match on the entire line in the white list, and combine the whole thing
into one "egrep" call:

:0:
* $ ? /bin/egrep -i -q "^($FROM|$REALLY_FROM)\$" $HOME/.white_list
$DEFAULT

(The \$ above escapes $ from procmail's grasp.)

but this has problems that need to be addressed, because $REALLY_FROM
might use the paren notation for an address, as in
  [EMAIL PROTECTED] (Alfred E. Newman)
and this will mess up egrep. In general, to make things right, if
you use egrep, you'll need to backslash quote all characters that
are "magic": ?, +, {, |,  ( and ).



-------------------------------------------------------
This SF.net email is sponsored by: eBay
Get office equipment for less on eBay!
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
Spamassassin-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk
On Sat, 31 May 2003, Theo Van Dinter wrote:

> On Sat, May 31, 2003 at 01:34:53PM +0100, Jim Ford wrote:
> > What, using procmail to send the trusted mail straight to the mailbox,
> > bypassing SA? (Procmail - another program I'll have to get to grips with!)
> 
> If you're using procmail, yes.  Basically you need to put the logic of
> "do I want to filter this mail" into whatever you use to call SA.
> 
> I run with procmail and have it take any moderated mailing lists I'm
> on and put them directly into a folder.  Everything else gets runs
> through SA before being delivered somewhere.
> 
> 

-- 

Jack Gostl      [EMAIL PROTECTED]



-------------------------------------------------------
This SF.net email is sponsored by: eBay
Get office equipment for less on eBay!
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
Spamassassin-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk

Reply via email to