Viktor Dukhovni: > On Sat, Jan 21, 2023 at 02:49:34PM -0500, Wietse Venema wrote: > > > Correction: the MTA<==>Milter protocol hides the Received: header > > that is prepended by the MTA, but it exposes headers that are already > > present. That's what Sendmail does, and therefore Postfix, too. > > Not only does Sendmail do this, it actually makes sense. The milter > logically sits **between** the remote sender and the receiving MTA. > Headers that are added by the local MTA are downstream of milter > processing.
For practical reasons, Postfix has to go before Milters. Specifically, Postfix goes before Milters when processing SMTP commands, including an envelope sender or recipient. Postfix decides if it will reject an SMTP command. If Postfix does not reject that command, then the first Milter decides if it will reject that command, and so on. If an envelope sender or recipient are not rejected, Postfix makes its changes before it stores that envelope content. Postfix also goes before Milters when processing header/body content. Postfix modifies/rejects header/body content before it stores that content. Then the first Milter reads/modifies/rejects that stored header/body content or modifies the stored envelope, then the second Milter, and so on. I believe that this does not differ much from the way that Milters work in Sendmail. They keep the header in memory (limited to ~32kB), but the body can be much larger, and at the time it was not customary to keep the entire message body in memory. Wietse