procmail
[Top] [All Lists]

Re: relaying messages

1999-08-07 14:00:53
John Conover asks:
When using something like:

    :0
    * ^To:.*someone
    ! someone(_at_)somedomain(_dot_)com

in a procmail script, the "From someone(_at_)someplace(_dot_)com ..." record 
in
the email is changed to the account and machine that procmail is
running on.

Correct... this was added at delivery, in fact, and (in that form) is
not part of any mail you'll send out either.  The address in it
represents the SMTP MAIL FROM address, which is where bounces will
go (and you wouldn't want errors from the forwarded copy to bounce
back to the original sender... trust me on this  :-)

Can the original "From " record be preserved?

You can preserve the information in it in another header.  I do
something like the following, although I don't sort on "To" myself
(too un-useful):
:0
* ^To:.*someone
* ^From +\/[^ ].*
|formail -A"X-Fwd-From: me(_at_)thisdomain(_dot_)com" -A"Old-From_: $MATCH" | \
        $SENDMAIL -oi someone(_at_)somedomain(_dot_)com

The second condition I added will always be true, and is only used
to set the value in $MATCH to the contents of From_ with leading
spaces removed.

This adds two headers; one says where I forwarded it from, and
the other says what the original "From " contained; and then forwards
as before.  Season to taste.

Hope that helps,
Stan

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