Subject: Re: Adding X-Originally-To: header to forwarded mail

From: [email-masked] (Stephen R. van den Berg)
Date: Thu, 2 Feb 1995 15:36:51 +0100

>Greetings all. I'm using procmail 3.10 to filter mail coming through a funnel;
>that is, all mail [email-masked] is being sent by sendmail V8 into a specific
>mailbox, and I want to use procmail to spearate and distribute the mail
>according to who it was originally addressed to. I'm using the rewrite
>function in sendmail to map [email-masked] to [email-masked].

The following recipe (or something similar) should do the trick:

:0 fhw
* !^X-Envelope-To:
* ^Received:.* by digimark\.net .* for \/<[^>]+@domain\.com>
| formail -a "X-Envelope-To: $MATCH"

>What I want to do is to add a custom header 'X-Originally-To:' to 
>every message based on the last 'Received' line, as this is the only
>way I have to know who it was addressed to before the rewrite in sendmail.
>(Correct me if I'm wrong on this.)

True, unless you change the rewrite to something like:

	[email-masked]	->	og+someaddr[]domain.com

But then you have to have the meta-argument passing in place (see
examples/advanced in the procmail distribution).

-- 
Sincerely,                                  [email-masked]
           Stephen R. van den Berg (AKA BuGless).

"My name is Smith, the P is not pronounced."