procmail
[Top] [All Lists]

Re: Regexp help

2002-04-26 12:39:50
What I'm trying to do is set up a domain-wide filter (called with -m as a
postfix transport).  I have postfix (as arg $2) passing a list of
recipients from the envelope.  I need to take the first recipient from
that arg and parse the domain out of the address (unfortunatly postfix
doesn't deliver that variable in any way to a piped transport).

I can see from all the FAQ's, etc. how to go about parsing from a header
and doing an extraction but I can't see how to do this from an existing
variable.  Can anyone give me a pointer?

To test against a variable (say $VAR) you use '??' on the condition
line.  For example:

    :0:
    * VAR ?? blah
    mymailbox

will deliver to 'mymailbox' if $VAR contains 'blah'.

So I think that what you're asking for is something along the lines of:

    MYARG=$2

    :0:
    * MYARG ?? \<interesting\.domain\.kom\>
    mymailbox
Is that the sort of thing you want?


Mmmm, sort of.  What I'm really after is to pull any right-hand value
(after the '@') in that first recipient and assign it to the variable
$DOMAIN.

Basically I'm setting up a site-wide .rc in /opt/procmail/filter.rc.
I then need to pull the domain from the first recipient in $2 and then
include another .rc in the fashion of

$INCLUDERC = /opt/procmail/domains/$DOMAIN/main.rc

that has all of the specific rules for that recipient domain. I need to
turn this box into a "cleansing relay" that will run spam filtering rules
on mail relayed to a client, and each client's domain needs to have thier
own set of rules (such as one doing RBL checking while another only checks
the ^To: line, etc.) so they can filter as much or as little spam as they
want.

TIA,
--
Jim Raney

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

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