Hi, While writing a milter for use with Postfix, I was unable to change the first header field and instead of changing it, Postfix appends it to the end of the header. Incidentally, as I believed this was a bug with the milter library, I rewrote the milter server implementation from scratch and came to the same conclusion.
Steps to reproduce: 1. Create a file mail.txt with contents: From: [email protected] To: [email protected] Subject: Test mail Content. 2. Execute: cat mail.txt > sendmail -t -f [email protected] 3. Return modification response in the EOB request as a "chgheader" with index=1, name="From", value="[email protected]" 4 Verify in /var/spool/mail/[user] that it appends the header field: >From [email protected] Wed Feb 21 21:54:27 2024 Return-Path: <[email protected]> X-Original-To: [email protected] Delivered-To: [email protected] From: [email protected] To: [email protected] Subject: Test mail Message-Id: <[email protected]> Date: Wed, 21 Feb 2024 21:54:27 +0100 (CET) From: [email protected] Content. This will append a header field "From: [email protected]" to the end of the header fields, instead of replacing the first header field. When you reverse the order of From and To (i.e. To comes first, and From second) and you return the same modification response from the milter, it works as expected; it does not append a new header, but replaces now the second header field (or equally, the first From header field). Is this because Postfix expects the first header field to be a "Received" header field it prepends itself? According to the source code this field cannot be changed and is skipped when issuing chgheader from a filter ( https://github.com/vdukhovni/postfix/blob/master/postfix/src/cleanup/cleanup_milter.c#L798). Reading the "/var/spool/mail/root" file I do not see a Received header prepended for these mails (it does for other mails...!). Kind regards, Taco de Wolff
_______________________________________________ Postfix-users mailing list -- [email protected] To unsubscribe send an email to [email protected]
