Prev: recipient_delimiter and check_recipient_access
Next: Postfix (Ubuntu 9.10 x64) said: 421 4.4.1 Connection timed out (in reply to end of DATA command)
From: Razvan Cosma on 27 May 2010 17:54 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: scriptalias(a)mydomain.com. In the postfix relay host I added 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: scriptalias(a)mydomain.comfrom somehost[1.2.3.4]; from=< zzz(a)domain1.com> to=<aaa(a)domain2.com> proto=SMTP: Return-Path: scriptalias(a)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 zzz(a)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?
From: mouss on 27 May 2010 18:19 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: scriptalias(a)mydomain.com > <mailto:scriptalias(a)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: scriptalias(a)mydomain.com > <mailto:scriptalias(a)mydomain.com> from somehost[1.2.3.4]; > from=<zzz(a)domain1.com <mailto:zzz(a)domain1.com>> to=<aaa(a)domain2.com > <mailto:aaa(a)domain2.com>> proto=SMTP: Return-Path: > scriptalias(a)mydomain.com <mailto:scriptalias(a)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 zzz(a)domain1.com > <mailto:zzz(a)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.
From: Wietse Venema on 27 May 2010 19:26 Razvan Cosma: > /^Return-Path: (.*)/ REPLACE X-Original-Return-Path: $1 > /^X-bounces-to: (.*)/ REPLACE Return-Path: $1 The Return-Path: header DOES NOT CONTROL delivery of bounce messages. Instead, bounce messages are sent to the envelope sender address (the address in the MAIL FROM command). Wietse
From: Razvan Cosma on 28 May 2010 05:14 Hi - understood. Now, as the messages are received from other hosts, I can't change the MAIL FROM part of the conversation. Also, as they are sent from ..net (using system.net.mail) the sender application can't change the envelope sender without changing the From: line too (it's a limitation of that class). The alternatives now are to 1. not use system.net.mail, and write another smtp class in .net 2. somehow make postfix insert a header that makes other mailer-daemons bounce NDRs/out-of-offices/etc to it, instead of the From: address. #1 is far from trivial for various reasons, so any hints towards #2 would be very helpful On Fri, May 28, 2010 at 2:26 AM, Wietse Venema <wietse(a)porcupine.org> wrote: > Razvan Cosma: > > /^Return-Path: (.*)/ REPLACE X-Original-Return-Path: $1 > > /^X-bounces-to: (.*)/ REPLACE Return-Path: $1 > > The Return-Path: header DOES NOT CONTROL delivery of bounce messages. > > Instead, bounce messages are sent to the envelope sender address > (the address in the MAIL FROM command). > > Wietse >
From: Wietse Venema on 28 May 2010 06:06
Razvan Cosma: > Hi - understood. Now, as the messages are received from other hosts, I can't > change the MAIL FROM part of the conversation. Also, as they are sent from > .net (using system.net.mail) the sender application can't change the > envelope sender without changing the From: line too (it's a limitation of > that class). The alternatives now are to > 1. not use system.net.mail, and write another smtp class in .net > 2. somehow make postfix insert a header that makes other mailer-daemons > bounce NDRs/out-of-offices/etc to it, instead of the From: address. > #1 is far from trivial for various reasons, so any hints towards #2 would be > very helpful Postfix has a HUGE document on address rewriting (headers and envelopes). Try "postfix address rewriting" in your favorite search box. Wietse |