On Tue, Sep 08, 2026 at 08:42:18PM +0100, Mark Hills wrote: > Here's an example: I would like our outbound SMTP servers to strip > "Received" headers, to avoid exposing some gnarly details of our internal > network (eg. prototype script below) > > There needs quite a lot of code to sit between smtpd and this script.
About 300 lines of C. Possibly less. > I could write that code, but probably error-prone. Even if I avoid bugs, > there's the need to handle concurrency and buffer messages to temp files. You don't need to buffer messages to temp files. The existing filter API is line-based. You could use the same logic as the awk script you wrote for the actual header line removal, all that is required is field-splitting the lines that you receive via the filter API, session management, and error handling. Written like that, it might sound ominous, but about 98% of this has already been done for you, (we published a guide to writing smtpd filters which includes examples of such logic).
