> I'm trying to use your headers.rc include file, but I can't get the $FROM
> macro to work. The mail is coming from a friend, whose From: line is:
> John Doe <jdoe(_at_)nowhere(_dot_)com>
> but I never get a match. The logfile has the full expansion of $FROM in
it
> and I am confused. I also tried it without the POST_ADDR_SPAN, but that
> didn't work either.
>
> My .procmailrc:
>
> -----
Huh? This is a procmail script, not a shell script. Get rid of this line.
> #!/bin/sh
>
> PATH=$HOME/bin:/usr/bin:/usr/sbin:/usr/ucb:/bin:/usr/lib:/usr/local/bin:.
> MAILDIR=$HOME/Mail # You'd better make sure it exists
> LIB=$MAILDIR/rc.files
>
> {snip}
>
> # Pull in the standard header patterns
> INCLUDERC=$LIB/headers.rc
So, the "headers.rc" file is at $HOME/Mail/rc.files/headers.rc"?
If the file is not at the right place, procmail will not post an
error, and keep right on going.
> {snip}
>
> # Zip friend's email to the other account
>
> :0
> * $ $FROM(jdoe(_at_)nowhere(_dot_)com)POST_ADDR_SPAN
> | formail -A "X-Loop: $HERE"
> | sendmail -oi $THERE
Two big problems here:
1. POST_ADDR_SPAN has no '$' to mark it as a variable, so it
is matched as literal text. Which fails. Always. Unless
you get mail from "POST_ADDR_SPAN" :^)
Also, you don't really need POST_ADDR_SPAN unless you wish to match
something else after the address. If the match is okay up to the
beginning of $POST_ADDR_SPAN, then you are pretty certain of a good
match--extra matching is superfluous.
2. You cannot continue an action without an escaped newline. The recipe
should read:
:0
* $$FROM(jdoe(_at_)nowhere(_dot_)com)
| formail -A "X-Loop: $HERE" \
| sendmail -oi $THERE
Another way, though is:
:0 fh
* $$FROM(jdoe(_at_)nowhere(_dot_)com)
| formail -A "X-Loop: $HERE"
:0a
! -oi $THERE
I prefer the second method because:
* it is more efficient, since formail doesn't have to read the entire
message;
* it is more portable, since it uses the pre-configured delivery agent,
$SENDMAIL $SENDMAILFLAGS, which may not always be sendmail.
G'luck.
_____________________________________________________________________
Alan Stebbens <stebbens(_at_)sgi(_dot_)com> (415) 933-6437
Digital TV, Silicon Interactive Group, Silicon Graphics, Inc. (SGI)
M/S:9L991, 2011 N. Shoreline Blvd., Mountain View, CA 94043
PGP Key Fingerprint: 94 A7 4B AB 1C F0 4D 92 DD BC B5 D7 11 A0 DC B3