procmail
[Top] [All Lists]

Re: Filtering all incoming and outgoing mail

2000-05-13 17:34:44
"Sean A. Walberg" <sean(_at_)escape(_dot_)ca> writes:
I've seen this question asked time and time again in the archives, but I
seem to be doing something wrong here.  I've got a machine that accepts
mail on behalf of a few domains, and then forwards them to the appropriate
mail server based on the mailertable and some dns-oddities.

In /etc/sendmail.cf I have

Mprocmail,      P=/usr/bin/procmail, F=mSDFMhun, S=11, R=21,
               A=procmail -m $h $g $u

S98
# Mail filtering
R$*<@$+>$*      $#procmail $@/etc/procmailrcs/filter.rc $:$1(_at_)$2procmail$3
R$*<@$*.procmail>$*     $1@<$2>$3       map back of procmail copy

If you want to send _all_ mail through procmail then you need to swap
the order of the rules: you need to test for the loop before you start
it again.  I assume it's a typo in the first of the rules that you lack
a period between "$2" and "procmail".

S98
# Mail filtering
R$*<@$*.procmail>$*     $@ $1@<$2>$3    map back of procmail copy
R$*<@$+>$*              $@ $#procmail $@/etc/procmailrcs/filter.rc 
$:$1(_at_)$2(_dot_)procmail$3

Note the use of $@ to return from the ruleset.  If you have other rules
in ruleset S98 then you should move these two into their own ruleset
which is called from S98.


Philip Guenther

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