I'm having some trouble matching headers. I add X-Loop: headers to my mail
so I know where it came from and so it doesn't get re-forwarded again and
again and ..., because I forward all mail from my work account to my
student account (w/ a modified subject) and all work-related mail (that
shouldn't be sent to my student account, but is) to work account.
Mail bounced big-time. It seemed that the *!^X-Loop conditions were not
matching correctly. So I added some experimental code to my .procmailrc:
#!/bin/sh
Not really related, but: Do I really need that line?
PATH=$HOME/bin:/usr/bin:/usr/lib:/usr/sbin:/usr/ucb:/bin:/usr/local/bin:.
MAILDIR=$HOME/Mail # You'd better make sure it exists
DEFAULT=/var/mail/$LOGNAME # Let's store things in the system mailbox
LOGFILE=$MAILDIR/logfile
HERE=degennar(_at_)bmsrs(_dot_)usc(_dot_)edu
THERE=ray(_at_)uscsoft10(_dot_)usc(_dot_)edu
SUBJECT=`formail -z -x"Subject:"`
:0 fw
| formail -A "X-Loop: $HERE"
This recipe acts as it should and adds the header:
X-Loop: degennar(_at_)bmsrs(_dot_)usc(_dot_)edu
:0 c
* !^X-Loop: $HERE
not_here
This recipe doesn't work. It should always fail (because I just added the
X-Loop header -- and it is there), yet it always matches. From the logfile
w/ VERBOSE=on:
...
procmail: Match on ! "^X-Loop: $HERE"
...
I think that's my problem. $HERE doesn't get expanded to
degennar(_at_)bmsrs(_dot_)usc(_dot_)edu
:0 c
* !^X-Loop: $THERE
not_there
This recipe doesn't work either, it always matches.
:0
* ^From.*uscsoft.*
* !^X-Loop: ray(_at_)uscsoft10(_dot_)usc(_dot_)edu
| sendmail -oi $THERE
The shell variable works fine here.
[the rest is snipped]
I could just hard code the addresses, but I have very similar code in the
two accounts, and I just wanted to chage HERE= and THERE=.
Any ideas?
ray
-----
Ray DeGennaro
degennar(_at_)bmsrs(_dot_)usc(_dot_)edu
-----
Those who swap freedom for safety, deserve neither. (Benjamin Franklin)