Razvan Cosma a écrit :
>  Hi everyone,
> I am trying to get message bounces/delays piped into a script while
> keeping the user-visible From: header intact. To do this, I have asked
> the senders to relay through me and include a header of the form
> X-bounces-to: scriptal...@mydomain.com
> <mailto:scriptal...@mydomain.com>. In the postfix relay host I added
> main.cf <http://main.cf>:
>  header_checks = regexp:/etc/postfix/header_checks
> header_checks:
>  /^Return-Path: (.*)/            REPLACE X-Original-Return-Path: $1
>  /^X-bounces-to: (.*)/        REPLACE Return-Path: $1
> The log does say
>  postfix/cleanup: replace: header X-bounces-to: scriptal...@mydomain.com
> <mailto:scriptal...@mydomain.com> from somehost[1.2.3.4];
> from=<z...@domain1.com <mailto:z...@domain1.com>> to=<a...@domain2.com
> <mailto:a...@domain2.com>> proto=SMTP: Return-Path:
> scriptal...@mydomain.com <mailto:scriptal...@mydomain.com>
> which sounds a bit odd - is this a concatenation of several informations
> from the message headers or some error on my part?
> 
> The messages do go out with the wrong return-path - the address used in
> the MAIL FROM: line, in this case z...@domain1.com
> <mailto:z...@domain1.com>. My question would be: does cleanup(8) do
> another replace of the headers just before the message leaves the
> system? If so, can it be disabled?
> 

You must understand the difference between the "envelope" and the
"headers". The MAIL FROM command specifies the _envelope_ sender. The
fact that this gets written into the Return-Path header is a good thing,
but it happens at delivery time (and it is optional. see the manpage of
"pipe"...).


to play with the sender address, use smtp generic maps. but better set
the correct sender address at the time the message is sent. users can do
"sendmail -f $sender...". This is better than relying on headers. and it
follows an old principle: fix problems near the source.



Reply via email to