rewriting from and reply-to headers: milter vs canonical maps/header checks
Hi all, Apologies in advance if this is a redundant query. I did some searching on the previous list posts and wasn't able to find a definitive recommendation on this. What I am trying to do is: Setup a SMTP relay for outgoing mail where: (a) All From: headers of the form u...@cooldomain1.com (example) are rewritten to be no-re...@cooldomain2.com (b) A Reply-To: header with the original u...@cooldomain1.com is added I have achieved this by using this combination: -- using sender_canonical_maps set to: @cooldomain1.com no-re...@cooldomain2.com -- using header_checks set to: /^From: (.*@cooldomain1\.com)/ PREPEND Reply-To:$1 This seems to work. However, I am not sure if this is a good approach or would using a milter (FILTER action in header_checks) be a better way? If so, is there a pre-existing milter available for this that is recommended? Thanks all. cheers, VM
Re: rewriting from and reply-to headers: milter vs canonical maps/header checks
Venkat: > What I am trying to do is: > > Setup a SMTP relay for outgoing mail where: > (a) All From: headers of the form u...@cooldomain1.com (example) are > rewritten to be no-re...@cooldomain2.com > (b) A Reply-To: header with the original u...@cooldomain1.com is added > > I have achieved this by using this combination: > -- using sender_canonical_maps set to: > @cooldomain1.com no-re...@cooldomain2.com > -- using header_checks set to: > /^From: (.*@cooldomain1\.com)/ PREPEND Reply-To:$1 > > This seems to work. However, I am not sure if this is a good > approach or would using a milter (FILTER action in header_checks) > be a better way? If so, is there a pre-existing milter available > for this that is recommended? Thanks all. Your configuration should be safe, if I read Postfix documentation carefully. Remember, undocumented Postfix behavior is not covered by any promise of future compatibility. The header_checks manpage promises that PREPENDed text is not subject to header_checks or address rewriting, and that it does not affect the way that Postfix adds missing message headers. So this part of your design is safe. Does Postfix documentation promise that header_checks happen before address rewriting? It makes that promise in a non-obvious manner. The text for the "REPLACE" action says that the replacement text will be subject to address rewriting (among other things). This suggests that header_checks happen before address rewriting. So there is an implicit promise that header_checks happen before address rewriting. This order should probably be documented, along with the relative timing of Milter activity. Wietse
Re: rewriting from and reply-to headers: milter vs canonical maps/header checks
Thank you very much for the detailed explanation Wietse, it makes more sense to me now re: the order of operations. Cheers, VM On Aug 21, 2014 5:31 AM, "Wietse Venema" wrote: > Venkat: > > What I am trying to do is: > > > > Setup a SMTP relay for outgoing mail where: > > (a) All From: headers of the form u...@cooldomain1.com (example) are > > rewritten to be no-re...@cooldomain2.com > > (b) A Reply-To: header with the original u...@cooldomain1.com is added > > > > I have achieved this by using this combination: > > -- using sender_canonical_maps set to: > > @cooldomain1.com no-re...@cooldomain2.com > > -- using header_checks set to: > > /^From: (.*@cooldomain1\.com)/ PREPEND Reply-To:$1 > > > > This seems to work. However, I am not sure if this is a good > > approach or would using a milter (FILTER action in header_checks) > > be a better way? If so, is there a pre-existing milter available > > for this that is recommended? Thanks all. > > Your configuration should be safe, if I read Postfix documentation > carefully. Remember, undocumented Postfix behavior is not covered > by any promise of future compatibility. > > The header_checks manpage promises that PREPENDed text is not subject > to header_checks or address rewriting, and that it does not affect > the way that Postfix adds missing message headers. So this part > of your design is safe. > > Does Postfix documentation promise that header_checks happen before > address rewriting? It makes that promise in a non-obvious manner. > > The text for the "REPLACE" action says that the replacement text > will be subject to address rewriting (among other things). This > suggests that header_checks happen before address rewriting. > > So there is an implicit promise that header_checks happen before > address rewriting. This order should probably be documented, along > with the relative timing of Milter activity. > > Wietse >