procmail
[Top] [All Lists]

Re: GREPing files in procmail conditions

2003-12-07 10:44:43
On Sun, Dec 07, 2003 at 05:41:13PM +0100, Ralf Hagen wrote:

:0
*^X-SPAM-Flag:.*YES           # If there is a set X-SPAM-Flag
*!(?formail -x"To:"\            # Negation: Get To: address
| egrep -is -f /etc/validusers) # Compare to list of valid users
!nobody                               # drop.

There seems to be a mistake in there still. :-(

Optimistically, I think it's a small one.

What do your log files say?

By the way, I don't off-hand see why the parens are necessary.

If you don't have regexes in your /etc/validusers file, which
I don't guess you do, then use fgrep.  Moreover, the formail
implementation is going to be problematic, because there
can be multiple addresses, and also name text and other
punctuation, on the To: line.  (And what if your user was
Cc'd or Bcc'd?)

Is there anywhere a bigger procmail-rules-examples howto than man 
procmailex?

There are many FAQ pages.  One very good one is here:
http://www.ii.com/internet/robots/procmail/qs/

Also, at www.procmail.org down lower on the page, besides the
link to the searchable list archive that you didn't find earlier
today, :-) is a list of some useful explanatory pages and FAQs.

Regarding your "!nobody" to drop the mail, if that's
invoking sendmail or a clone, then it's not as efficient
as simply exiting procmail gracefully.  You can unset
the $HOST variable or change it to something bogus to
exit procmail without delivery.  Thus:

  :0
  * conditions
  { HOST = byebye }

would exit gracefully and not put the message in $DEFAULT.

-- 
dman

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail