Viktor Dukhovni:
> On Thu, Jun 09, 2022 at 01:53:39PM -0400, Wietse Venema wrote:
> > Viktor Dukhovni:
> > > On Thu, Jun 09, 2022 at 09:19:11AM -0400, Wietse Venema wrote:
> > > 
> > > > Below is the order of how Postfix receives email. Steps with "*"
> > > > are logged with -v or with -v -v, other steps are logged only when
> > > > they fail.
> > > > 
> > > >         * repeat: receive header and send header to milter
> > > > 
> > > >         * send 'end of headers' to milter
> > > > 
> > > >         receive body
> > > 
> > > I was under the impression (not yet backed by code inspection) that
> > > milter content processing does not begin until the message body is
> > > received in its entirety.  And I'd na?vely expect the second milter
> > > (...) to only see the headers/body after the previous milter is done
> > > processing both.
> > 
> > Correct. First the entire message is received. Then the MIME processor
> > walks over file and sends headers or body chunks to the 'current'
> > milter. Then repeat the previous sentence for the next milter.
> 
> So in that case, "smtpd_end_of_data_restrictions" actions would I think
> run *before* milter header/body processing...

The text below swaps smtpd_end_of_data_restrictions and sending
headers to the milter.

Steps with "*" are logged with -v or with -v -v, other steps are
logged only when they fail. Most steps below happen in the cleanup
daemon.

        * receive headers (logs message-id; optional header_hecks logging)

        receive body (optional body_checks logging)

    at this point you could use smtpd_end_of_data_restrictions to
    log an info or warn event

        * repeat: send header to milter

        * send 'end of headers' to milter

        * repeat: send body chunk to milter

        * send end-of-body to milter and allow envelope/header/body changes

        flush queue file handle

        fsync queue file handle

        close queue file handle

        optionally change the queue file timestamp if the Postfix
        host clock differs from the file server's clock.

        * send a 'trigger' to the queue manager

        * send queue file status from cleanup daemon to smtpd daemon

        * in the smtpd daemon, reply to "." with OK or error

If there is a delay between any of these steps then we know more.

        Wietse

Reply via email to