procmail
[Top] [All Lists]

Re: How to?

1997-05-14 13:33:00
Erdem Ozsaruhan <eozsaruh(_at_)nsf(_dot_)gov> writes:
One more question:

I want to be able to use that rc file from /etc/aliases. Something
like:

testacct:      | "/usr/local/bin/procmail -m /home/testuser/rc1"

Instead of checking the Subject with:

      * ^Subject:.*TEST1*

I want to check the To field with:

      * ^TOtestacct

But when I call procmail like that from the /etc/aliases file,
procmail fails to check the To: field. How can I pass the To: field to
procmail? ( | "/usr/local/bin/procmail -m /home/testuser/rc1 -d testacct"
didn't work.)

I need to check the To: field, because that rc file (rc1) is going to
be used by more than one address.

Pass in the alias involved on procmail's command line, then check $1 to
see what the envelope recipient was:

testacct:       "|/usr/local/bin/procmail -m /home/testuser/rc1 testacct
testacct2:      "|/usr/local/bin/procmail -m /home/testuser/rc1 testacct2


        TO = $1

        :0
        * TO ?? ^^testacct^^
        { # do testacct stuff
        }

        :0
        * TO ?? ^^testacct2^^
        { # do testacct2 stuff
        }


This even works correctly if testacct is subscribed to a mailing list, or
is sent a Bcc:.

Philip Guenther

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