[pfx] Re: header_checks sees original From: header despite smtp d milter correction — execution order question

Viktor Dukhovni via Postfix-users <[email protected]> Mon, 18 May 2026 20:57:11 +1000
Newsgroups gmane.mail.postfix.user
Message-ID <[email protected]>
On Mon, May 18, 2026 at 10:21:32AM +0000, Pedro David Marco via Postfix-users wrote:
> Hi,
> I am trying to understand the exact execution order between header_checks/cleanup and smtpd_milters.
> I have a custom milter that repairs invalid From: headers 
> Example flow from logs:
> 1.- cleanup logs a header_checks warning on the original header From: <[email protected]>
> 2.- Then my milter replaces it with: From: <[email protected]>
> 3.- milter works ok, since postcat shows the corrected header in the queued message.
> What confuses me is that according to my reading of MILTER_README, smtpd milters run before queuing, so I expected cleanup/header_checks to see the modified header rather than the original one. However, the log shows that cleanup sees [email protected] and not [email protected].
> Am I misunderstanding how cleanup interacts with SMTP milters internally?

You failed to notice "milter_header_checks" in header_checks(5):

    https://www.postfix.org/header_checks.5.html

header and body checks run first, then milters, and then
milter_header_checks.  This could/should be documented more prominently,
perhaps in one or more of:

    https://www.postfix.org/CONTENT_INSPECTION_README.html
    https://www.postfix.org/BUILTIN_FILTER_README.html
    https://www.postfix.org/MILTER_README.html

-- 
    Viktor.  🇺🇦 Слава Україні!
_______________________________________________
Postfix-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]