Gmane
Picon
From: Bart Schaefer <barton.schaefer <at> gmail.com>
Subject: Re: Forwarding and Baracudda Spam Appliance
Newsgroups: gmane.mail.procmail
Date: 2005-07-13 18:18:04 GMT (2 years, 43 weeks, 3 days, 3 hours and 35 minutes ago)
On 7/13/05, Dallman Ross <dman <at> nomotek.com> wrote:
> 
> Well, how are you forwarding with procmail?  The situation you describe
> is not how things would look if you did a typical forward with procmail.
> 
>   :0
>   * conditions
>   ! forward <at> address.dom
> 
> does not change the sending domain any more than a .forward would.

Yes, it does.

It doesn't change the message headers, but it does change the SMTP
MAIL FROM: to be the user for whom the original delivery to procmail
was made.  Apparently the way they have sendmail configured, this did
not happen when a .forward file was used.

The solution is to obtain the original envelope sender (possibly by
extracting it from the Return-Path header, but it may be available as
$1 or $2 depending on how procmail is invoked from sendmail) and pass
it back to sendmail again with the -f option, which can usually be
accomplished like so:

:0
* conditions
! -f "$ENVELOPE_FROM" forward <at> address.dom

(assuming $ENVELOPE_FROM contains the address extracted from
Return-Path or wherever).

This probably won't work if the MTA command-line interface is not
sendmail-compatible, so  use with appropriate care.