procmail
[Top] [All Lists]

Re: keeping To: and From_ when forwarding?

1999-01-10 11:30:44
Vince LaMonica asked how to

| 2) forward their 'authorize' request to erosters, keeping both the
|    Subject: and body 100% intact, and making sure that the From_ header
|    shows their address and the To: header is addressed to erosters
|    (this .procmailrc is for an account named egrades, which runs
|    a similar, but different program).

{The subject line of the thread is misleading; he wants to keep From_ and
 change To:.}

Keeping From_ is a bad idea.  It's possible, and Christopher Lindsey has
shown a way to do so, but it's still a bad idea.  If somehow mail does not
get delivered properly from egrades to erosters, it should be bounced back to
egrades, not to the original sender, who (1) never wrote to erosters and (2)
can't fix the problem with mail to erosters.  Moreover, Vince, you don't find
out that mail to erosters is bouncing if the bounces go back to the people
who wrote to egrades, so the problem persists.  If mail arrives safely at
egrades and egrades's .procmailrc redirects it to erosters, the envelope
sender for the second leg should point back to egrades.  Every forwarding
point that changes the addressing should change the envelope sender, period.

| # the below recipe is in both 'egrades' and 'erosters' .procmailrc
| 
| :0 fhw
| | formail -I "From " -a "From "

Not a good idea, because it clobbers the original From_ with From:, and
they may be different.  But while you're calling formail, you might as well
include this:

  [formail ...] -i "To: erosters(_at_)your(_dot_)site" # note the lower-case -i

I disagree with Chris's suggestion to use -I; it might be useful to have the
original addressing preserved in an Old-To: header.

If you want the people or bots who handle mail to erosters to know the
original From_, then use this filter in egrades's .procmailrc inside the
braces, and erosters will receive that information in an Old-From_: header,
where it can use it without having bounces misdirected:

  # for egrades
  MATCH # clear out any lingering old value from higher in the rcfile
  :0fhw
  * ^^\/From .+
  | formail -A "Old-From_: ${MATCH-missing}" -i "To: erosters"

Then forward to erosters with the "!" operator, as you were doing before.

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