On Tue, Sep 21, 2010 at 12:35 PM, Victor Duchovni <victor.ducho...@morganstanley.com> wrote: > On Tue, Sep 21, 2010 at 11:56:41AM -0700, Yang Zhang wrote: > >> How do you get Postfix to keep a log of all outgoing mails, in their >> complete form (all headers + payload) as received from clients? The >> closest param I've found so far are always_bcc & friends, but these >> lose some information (at least the BCC field). Thanks in advance for >> any hints. > > The archives of this list contain suggestions of how to achieve this > with a regexp or pcre recipient_bcc_maps which generates copies of > the message without losing envelope information.
Was this the technique? http://www.arschkrebs.de/postfix/postfix_archive.shtml I tried this, but it doesn't preserve envelope information (BCCs are still lost - which makes sense to me and is what I expected). > > The alternative, as suggested by Wietse, is an SMTP "Y-adaptor" that forks > an SMTP transaction into two streams. I've been using this approach for > 5+ years. Messages are transmitted in parallel to both the archive and > the real destination, but "." is sent to the archive stream first, and > if that fails, the transmission to the real destination is aborted. > This has proved quite reliable. > > The main risk is that mail can be archived, but the main delivery could > tempfail, leading to multiple archive copies. It is useful to have > de-duplication logic in the archive-stream. And of course keep that > parallel to the archive next-hop as reliable as possible, in my case, > a local Postfix instance that does the real message routing. We were planning to handle things at our application level, but we wanted to first see if there was a simple way to accomplish this already with Postfix. Thanks to the helpful responses. -- Yang Zhang http://yz.mit.edu/