Patch below.

        Wietse

--- /var/tmp/postfix-3.9-20231210/src/smtpd/smtpd.c     2023-10-12 
11:34:40.000000000 -0400
+++ src/smtpd/smtpd.c   2023-12-10 18:52:56.000000000 -0500
@@ -3404,13 +3404,6 @@
     }
 
     /*
-     * PREPEND message headers above our own Received: header.
-     */
-    if (state->prepend)
-       for (cpp = state->prepend->argv; *cpp; cpp++)
-           out_fprintf(out_stream, REC_TYPE_NORM, "%s", *cpp);
-
-    /*
      * Suppress our own Received: header in the unlikely case that we are an
      * intermediate proxy.
      */
@@ -3570,6 +3563,15 @@
                    "\t(envelope-from %s)", STR(state->buffer));
 #endif
     }
+
+    /*
+     * PREPEND message headers before the incoming message content, but after
+     * our own Received: header. This respects expectations by the Postfix
+     * Milter implementation that the first header will be hidden.
+     */
+    if (state->prepend)
+       for (cpp = state->prepend->argv; *cpp; cpp++)
+           out_fprintf(out_stream, REC_TYPE_NORM, "%s", *cpp);
 }
 
 /* receive_data_message - finish envelope and open message segment */
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to