Murray S. Kucherawy: > > -----Original Message----- > > From: owner-postfix-us...@postfix.org > > [mailto:owner-postfix-us...@postfix.org] On Behalf Of Steve Fatula > > Sent: Tuesday, August 09, 2011 11:48 PM > > To: Postfix Users > > Subject: Order of milter execution > > > > Using Postfix 2.8.4, I have the following options to smtpd: > > > > -o content_filter=dspam:unix:/var/dspam/dspam.sock -o > > smtpd_milters=unix:/var/run/clamav/clamav- > > milter.sock,unix:/var/run/opendkim/opendkim.sock,unix:/usr/local/var/mi > > lter-greylist/milter-greylist.sock > > > > Reading the postfix doc, it says that "Milter applications are applied > > in the order as specified". Yet, in the maillog I see milter-greylist > > listing messages before opendkim. I was wanting to use the results of > > opendkim in milter-greylist. Perhaps that is not really possible? > > > > My guess, from my limited milter understanding, is they are executed > > piecemeal and that order is perhaps not so predictable. > > In the sendmail implementation, milters operate in order specifically > so that filters later in the chain see the effects of those that > come before. For example, a header field added by the first one > is visible to all the others. This is really the only practical > option since doing them all in parallel might mean two filters > request changes to the messages that conflict because their > respective "views" show the original message, not the modified > one. > > I can't imagine postfix would have done it any differently, partly > because of the above design, and partly because that would mean > the same combination of filters would have a different outcome if > you change MTAs, and that's just not good.
The order is 100% deterministic, and is as described in http://www.milter.org/developers/overview#ControlFlow, with one extra line as indicated with the comment below. For each of N connections For each filter process connection (xxfi_connect) For each filter process helo (xxfi_helo) MESSAGE: For each message in this connection (sequentially) For each filter process sender (xxfi_envfrom) For each recipient For each filter process recipient (xxfi_envrcpt) For each filter process DATA (xxfi_data) For each filter # this line may be Postfix-specific For each header process header (xxfi_header) process end of headers (xxfi_eoh) For each body block process this body block (xxfi_body) process end of message (xxfi_eom) For each filter process end of connection (xxfi_close) The comment indicates the line that may be specific to Postfix (i.e. all milters reply to the DATA command before any milter sees header/body content). Wietse