emersion / go-milter

Go library to write mail filters
BSD 2-Clause "Simplified" License
42 stars 19 forks source link

Can't change the first header field and regarding ChangeHeader indices #31

Closed tdewolff closed 8 months ago

tdewolff commented 8 months ago

It seems undocumented that the ChangeHeader index starts at 1 and not zero. When sending a mail such as:

From: foo1@domain.com
To: bar@domain.com
From foo2@domain.com

Message

This is regardless of whichever header field comes first, I simply can't change it. Might this be an issue with Postfix?

tdewolff commented 8 months ago

This is actually a bug in Postfix. You can circumvent the problem by issuing two modifications, first an insert at index=0, and then a chgheader at index=1 with empty value to delete the original. See https://www.mail-archive.com/postfix-users@postfix.org/msg101517.html