procmail
[Top] [All Lists]

Re: Forwarding and the from header...

1998-06-05 11:43:45
Matthew Harrell asked,

| When I forward mail mail from computer A to computer B using the recipe
| 
|   :0
|   ! $MY_ADDR
| 
| then the mail goes to computer B but the "From " header is rewritten to show
| that it came from me at computer A.

Yes, that is correct behavior.  The From_ address is used for returning unde-
liverable mail; if Z sends mail to A and A forwards it to B but B cannot re-
ceive it, then A is the one who has to be told, not Z.  Z didn't send any
mail to B and can't stop sending mail there; A needs to know that (s)he
should stop forwarding to B.  So if it is undeliverable to B, it should be
returned to A, not to Z.

| Is there any way to get it to not rewrite the "From " header?

Yes, but you shouldn't, and that is not the solution to the real problem.
The real problem is that the original From_ information as received by A
is not showing up in B's logfile:

| This is kind of annoying on computer B because I can't tell in the procmail
| log where the messages come from.

Bouncing mail for A all the way back to the original sender when A cannot
forward to B is like decapitation as a cure for a head cold.

In B's .procmailrc,

:0
* ^^From site\.of\.forwarder!forwarder
{ TRAP='formail -XFrom:' } # note: apostrophes, not backticks! 

or

:0
* ^^From site\.of\.forwarder!forwarder
{ LOG="`formail -XFrom:`
" } # note: backticks, not apostrophes!

will write the From: header to the logfile.  Since the forwarding did not
change the From: header, that should tell you who sent it.  If what you
need in B's logfile is the From_ address that the piece had when arrived
at A, then let A put it where B can find it; in A's .procmailrc,

 :0fh
 | formail -iReturn-Path:

and in B's .procmailrc,

:0
* ^^From site\.of\.forwarder!forwarder
{ TRAP='formail -XOld-Return-Path:' } # note: apostrophes, not backticks! 

or

:0
* ^^From site\.of\.forwarder!forwarder
{ LOG="`formail -XOld-Return-Path:`
" } # note: backticks, not apostrophes!

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