At 14:10 10/26/95, Brian Rankin wrote:
What I need to do is test REALFROM after it is generated.
Basically, if REALFROM="" I don't want to run the second formail
command. What's the syntax to test REALFROM?
There were a few problems with your example, so let's start from scratch.
First, I assume by "real from" you mean the envelope-from, or the "From "
header line. And, second, I assume you want to make that envelope from
address appear as the sender to your MUA by making sure it's the contents
of the "From:" header.
With those assumptions, and the information from "man procmailrc", we get
(untested):
# extract the envelope sender address, if present
# and use that as the new "From:" header
# extract just through the address, and skip the date on the From_ line
# but don't bother if it's already the same (so we can keep "real name"
# info if present).
:0 hfw
* ^From +\/[^ ]+
* $! ^From:.*$MATCH
| $BINDIR/formail -k -i"From: $MATCH"
If you need the value of $REALFROM later in your .procmailrc file, use
something like:
:0
* ^From +\/[^ ]+
* $! ^From:.*$MATCH
{
# save the original sender for future use
REALFROM = $MATCH
# now change the "From:" header to match.
:0 hfw
| $BINDIR/formail -i"From: $REALFROM"
}
--Hal
Hal Wine <hal(_at_)dtor(_dot_)com> voice: 510/482-0597