procmail
[Top] [All Lists]

Re: forwarding mail/leading white space/using formail

1997-02-21 23:05:57

Since David Tamkin has already answered David Epstein's other questions,
I'll just tackle the forwarding question:

David Epstein <mareb(_at_)csv(_dot_)warwick(_dot_)ac(_dot_)uk> writes:
The problem I have is that I run a majordomo list and want other
people to approve certain types of items by running the majordomo perl
script "approve" on the letter. I'm not sure what this perl script looks
at, whether it looks at the header or only at the body of the message.
Does anyone know?

So here's the procmail question:
how do I get procmail to send the letter on so
that it appears to come from the same sender as sent it to me?

There are at least two "sender" addresses associated with each piece of
email: at least one header sender and exactly one envelope sender.  The
former are what you see in the "From:" and "Sender:" headers, while the
latter shows up in SMTP transactions as the address given in the "MAIL
From:" command.  Once delivered it may appears in the message headers
as the "Return-Path:" or the address in the "From " pseudo-header which
separates messages in Berkeley mbox format.

When procmail forwards a message using the '!' action, or by piping the
message into $SENDMAIL, it does *not* change the header.  Thus, the
header sender(s) will be unchanged unless you change them yourself,
probably by filtering through formail.  The envelope sender on the
other hand must be set using the "-f address" argument to sendmail.
You'll therefore need to first extract the old/current envelope sender
from the message, then pass that to sendmail when you forward the
message out:

# Get the current envelope sender:
:0
* ! ^Return-Path: *\/[^ ]+
* ! ^From +\/[^ ]+
{
    # "This cannot happen".  Use the null return path to avoid a bounce
    SENDER = '<>'
}
:0 E
{ SENDER = $MATCH }

# later...

:0
* some conditions?
! -f "$SENDER" address...


Got it?


Philip Guenther

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