Yes, but my script does not know what is added/changed/replaced.It just need do to like "$ctx->replacebody" but the similiar for the headers.
What my script does, is taking the whole mail, (headers+body) and run through a loose MIME parser. Then it rebuilds the mail from the ground up in a "strict" fashion. If the MIME parser is unable to parse the mail because the MIME was very badly damaged, then it puts the content into a new fresh MIME mail.
This means I take the content, send through a black box, and get "changed content" back.
Thus, I cannot run the correct actions (add/replace/remove), because my script does not know what is changed.
What I need to do, is to completely clear all headers (except for Received - it wont matter if those headers are run through parser or not), and then insert all headers that comes from the parser.
-----Ursprungligt meddelande----- From: Wietse Venema
Sent: Sunday, March 01, 2015 8:12 PM To: Postfix users Subject: Re: Milter: Is it possible to completely replace headers? Sebastian Nielsen:
How can I completely replace the headers in a milter? The replaced header data contains both added and changed headers.
As of the last Milter bugfixes late 2014, you can delete or replace all headers except the Received: header that the MTA adds. The Milter protocol supports adding and replacing headers, and I expect that the Milter API supports the same operations. However, if you want to replace MIME headers then you need to be aware that the Milter protocol does not understand MIME. It sends all content after the first non-header line as body content. Header: Receiver: blah From: Subject: Mime-version: Content-type: Content-Transfer-Encoding: Body: --boundary [Mime headers for first body part] First body part --boundary [Mime headers for second body part] And so on.Wietse
smime.p7s
Description: S/MIME cryptographic signature