Hi, I wrote a small milter to archive incoming emails. While testing I noticed, that I never got the Received line inserted by the local Postfix itself. A tcpdump of the milter traffic doesn't show the Received line too. Out of curiosity I prepended a header line with smtpd_sender_restrictions
/./ PREPEND X-MTA: Local and checked again, whether I could see this X-MTA line in the milter header callback. I did not, but to my surprise the previously missing Received line was there. Removing the X-MTA PREPEND made the Received line dissappear again. So it seems to me, that the milter client eats the first header line and the milter does not see it. I tested Postfix 2.9.3 (Debian package) and Postfix 2.9.3 compiled from source. Both show the same behaviour. Here my postconf -n output and some example data (swaks test email, the email in mailbox, output of test-milter logging header callback): postconf -n output: alias_database = hash:/etc/postfix/aliases alias_maps = hash:/etc/postfix/aliases append_dot_mydomain = no biff = no body_checks = pcre:/etc/postfix/body_checks.pcre bounce_size_limit = 1 config_directory = /etc/postfix data_directory = /var/lib/postfix disable_dns_lookups = yes disable_vrfy_command = yes frozen_delivered_to = no header_checks = pcre:/etc/postfix/header_checks.pcre inet_interfaces = localhost inet_protocols = ipv4,ipv6 local_header_rewrite_clients = permit_mynetworks permit_sasl_authenticated mail_owner = postfix mailbox_command = /usr/bin/maildrop -d "$USER" -f "$SENDER" mailbox_size_limit = 0 message_size_limit = 35000000 mime_header_checks = mydestination = localhost localhost.example.com $myhostname mydomain = $myhostname myhostname = legolas.example.com mynetworks = 127.0.0.1 [::1] 192.168.128.9 mynetworks_style = host myorigin = $myhostname nested_header_checks = owner_request_special = no queue_directory = /var/spool/postfix recipient_delimiter = + sender_dependent_default_transport_maps = pcre:/etc/postfix/sender_transport.pcre setgid_group = postdrop smtp_generic_maps = pcre:/etc/postfix/generic.pcre smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd smtp_sasl_security_options = noanonymous smtp_sender_dependent_authentication = yes smtp_use_tls = yes smtpd_milters = inet:127.0.0.1:5555 smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination reject_unlisted_recipient smtpd_sender_restrictions = pcre:/etc/postfix/inc_head.pcre soft_bounce = no transport_maps = hash:/etc/postfix/transport virtual_alias_maps = pcre:/etc/postfix/virtual.pcre input (swaks): === Trying localhost:25... === Connected to localhost. <- 220 legolas.example.com ESMTP Postfix -> EHLO legolas.example.com <- 250-legolas.example.com <- 250-PIPELINING <- 250-SIZE 35000000 <- 250-ETRN <- 250-ENHANCEDSTATUSCODES <- 250-8BITMIME <- 250 DSN -> MAIL FROM:<t...@legolas.example.com> <- 250 2.1.0 Ok -> RCPT TO:<mar...@legolas.example.com> <- 250 2.1.5 Ok -> DATA <- 354 End data with <CR><LF>.<CR><LF> -> Date: Thu, 05 Jul 2012 20:20:55 +0200 -> To: mar...@legolas.example.com -> From: t...@legolas.example.com -> Subject: test Thu, 05 Jul 2012 20:20:55 +0200 -> X-Mailer: swaks v20120320.0 jetmore.org/john/code/swaks/ -> -> This is a test mailing -> -> . <- 250 2.0.0 Ok: queued as 91A53257F4 -> QUIT <- 221 2.0.0 Bye === Connection closed with remote host. output (in mailbox): Return-Path: <t...@legolas.example.com> X-Original-To: mar...@legolas.example.com Delivered-To: mar...@legolas.example.com X-MTA: Local Received: from legolas.example.com (localhost [127.0.0.1]) by legolas.example.com (Postfix) with ESMTP id 91A53257F4 for <mar...@legolas.example.com>; Thu, 5 Jul 2012 20:20:55 +0200 (CEST) Date: Thu, 05 Jul 2012 20:20:55 +0200 To: mar...@legolas.example.com From: t...@legolas.example.com Subject: test Thu, 05 Jul 2012 20:20:55 +0200 X-Mailer: swaks v20120320.0 jetmore.org/john/code/swaks/ This is a test mailing output (perl testmilter, header callback): --> in header callback Received: from legolas.example.com (localhost [127.0.0.1]) by legolas.example.com (Postfix) with ESMTP id 91A53257F4 for <mar...@legolas.example.com>; Thu, 5 Jul 2012 20:20:55 +0200 (CEST) --> in header callback Date: Thu, 05 Jul 2012 20:20:55 +0200 --> in header callback To: mar...@legolas.example.com --> in header callback From: t...@legolas.example.com --> in header callback Subject: test Thu, 05 Jul 2012 20:20:55 +0200 --> in header callback X-Mailer: swaks v20120320.0 jetmore.org/john/code/swaks/