procmail
[Top] [All Lists]

Re: preserve original "from" when forwarding

1996-08-28 21:58:17
At 01:01 PM 8/28/96 PDT, you wrote:

Now that I have my procmail recipe seperating mail for 
p*(_at_)domain(_dot_)name
and forwarding it onwards, I would like to find some way to
preserve the original "From: " field in the mail.
My recipe looks like this:

:0
*^TOp[^   \*(_at_)domain\(_dot_)name
! peter(_dot_)morrison(_at_)australia(_dot_)ncr(_dot_)com

When I receive forwarded mail, it always comes from 
"astea(_at_)domain(_dot_)name"
because that is the address that procmail is forwarding from.
I'd like to be able to REPLY to the real sender of the mail, sometimes.
I haven't found a procmail FAQ yet, so I would welcome a reference,
if the answer is in there. Otherwise, can anybody help?

Something like this might be a good start; it ain't perfect:

FROM=`$FORMAIL -rt -xTo:`
:0
*^TOp[^   \*(_at_)domain\(_dot_)name
| $FORMAIL -i"To: peter(_dot_)morrison(_at_)australia(_dot_)ncr(_dot_)com" \
  -i"From: $FROM" | $SENDMAIL -oi -t

And it could be made a bit better by inserting a little message about how
this mail is forwarded, maybe like this:

FROM=`$FORMAIL -rt -xTo:`
#
# Define "$FORWARD" as the name of a text file with a mesage that will say that
# this is forwarded mail.
#
# FORWARD
:0
*^TOp[^   \*(_at_)domain\(_dot_)name
| ($FORMAIL -i"To: peter(_dot_)morrison(_at_)australia(_dot_)ncr(_dot_)com" \
  -i"From: $FROM"; cat $FORWARD) | $SENDMAIL -oi -t

You might need to stick a "-k" argument in the FORMAIL line too.

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