procmail
[Top] [All Lists]

Re: Delivered-To: [adding it]

1999-06-17 04:32:25
On 17 June 1999, era eriksson <era(_at_)iki(_dot_)fi> wrote:
On 16 Jun 1999 05:08:55 -0700, Harry Putnam <reader(_at_)newsguy(_dot_)com>
wrote:
 > Liviu Daia <Liviu(_dot_)Daia(_at_)imar(_dot_)ro> writes:
 >> On 15 June 1999, Harry Putnam <reader(_at_)newsguy(_dot_)com> wrote:
 >> > Can be forwarded from those machines with a header added to make
 >> > them easily filterable when they arrive at: 
reader(_at_)newsguy(_dot_)com
 >> > Most of the time this is accomplished by filtering on the "To:
 >> > " header, but in those cases where the "To " address, for one
 >> > reason or another is not present, then it becomes a project to
 >> > filter them.  Much easier to just add a header at the forwarding
 >> > end.
 >> Basically, you want to filter messages by the envelope recipients.
 >> This can't be done, period.  Procmail is a delivery agent, not a
 >> MTA, so
 > Not clear what you are saying above.  Do you mean a header
 > cannot be added by formail, through a procmail recipe?  Its a
 > bit confusing to hear: you should "filter messages by envelope
 > recipients".  "Procmail... . doesn't have access to envelope
 > recipients" It would seem the conclusion would be [ procmail cannot
 > filter messages ]

One common misuse of Procmail is to try this for the "wrong purposes",
but if you are merely looking for something that can say "this came
via foo(_at_)bar(_dot_)com" where you don't really care how it ended up there,
as long as it went through the file /home/foo/.procmailrc on bar.com,
nothing could be simpler. Replace this:

    :0
    ! reader(_at_)newsguy(_dot_)com

with this:

    :0
    | formail -I "X-Delivered-Via: foo(_at_)bar(_dot_)com" \
      | $SENDMAIL $SENDMAILFLAGS reader(_at_)newsguy(_dot_)com

... where foo(_at_)bar(_dot_)com is the address whose .procmailrc contains 
this.

(You can probably modularize this if you want a single file you can
drop in at different accounts, i.e. get the domain name from uname -n
or whatever, and the user name from $LOGIN.)

    This works, of course, only if all messages are supposed to get to
reader(_at_)newsguy(_dot_)com(_dot_)  My understanding was this is not the case 
in the
initial setup (otherwise why would Harry care about what is in the "To:"
and what not?).

    Regards,

    Liviu Daia

-- 
Dr. Liviu Daia               e-mail:   Liviu(_dot_)Daia(_at_)imar(_dot_)ro
Institute of Mathematics     web page: http://www.imar.ro/~daia
of the Romanian Academy      PGP key:  http://www.imar.ro/~daia/daia.asc