[PLUG] Procmail Ignores Rule

Cooper Stevenson cooper at cooper.stevenson.name
Wed Oct 1 12:09:01 UTC 2003


All,

First, I have an environment variable in /etc/procmailrc that grabs the
"user" portion of the recipient's email address:

  # The recipient's address
  ENV_TO=$1

I have this rule so that all emails addressed to "good at host.domain.com"
are placed in the /var/spool/mail/reported_good file:

:0: fwh
  * ^To: good at host.domain.com
  /var/spool/mail/reported_good

Fine. I know this worked before I added the rule outlined below.

Now, I want to say, "If the sender's address isn't good at host.domain.com,
forward the rest of the mail to user at forward_host.domain.com after
having first re-written the "To:" field (remember the "$ENV_TO" variable
I mentioned above. Never mind why...well, okay, it's because Exchange is
stupid:

  :0 fwh
     | formail -I"To: "$ENV_TO"@"
     :0
       ! "$ENV_TO"@forward_host.domain.com

The only trouble is that even though the "To:" rule is above the
"$ENV_TO" rule, procmail simply grabs onto the "ENV_TO" rule and
processes it first!

Would anyone like to give me a clue why the latter rule is processed
before the first rule?!!?


Best,
-- 
--------------------------------------------------------------
| Cooper Stevenson        | Em: cooper at cooper.stevenson.name |
| Open Source Consultant  | Ph: 541.924.9434                 |
--------------------------------------------------------------






More information about the PLUG mailing list