On 19.3.2016 16:02, Wietse Venema wrote:
Istvan Prosinger:
[root@email ~]# postmap -h -q - pcre:/etc/postfix/stamp.pcre < testheader

Received: from localhost (localhost [127.0.0.1])
          by email-test.server.com (Postfix) with ESMTP id 3qRyhf4pqCzKmYs
          for <ist...@email-test.server.com>; Sat, 19 Mar 2016 06:17:54
-0400 (EDT) Prepend X-DIYL-3qRyhf4pqCzKmYs
Received: from knox.prosinger.net (knox.prosinger.net [5.44.101.107])
          by email-test.server.com (Postfix) with ESMTPS id 3qRyhf0ChgzKmYq
          for <ist...@email-test.server.com>; Sat, 19 Mar 2016 06:17:52
-0400 (EDT) Prepend X-DIYL-3qRyhf0ChgzKmYq

I think that this means two hits.

Two Received headers match the pattern, each returns a prepend action.

If so, what comes to my mind is that these headers are not there
yet, in the moment when the stamper.pcre is called.

Postfix's own Received: header is prepended by smtpd(8) when receiving
mail from the network:

     Received: from client-info by server-info ...

this happens BEFORE the cleanup server does the header_checks matches.

Postfix's own Received: header is prepended by pickup(8) with mail
from /usr/sbin/sendmail:

     Received: by server-info ...

this happens BEFORE the cleanup server does the header_checks matches.

        Wietse


Yessss...but I was not doing header checks, I was calling to it in smtpd_recipient_restrictions

It works now.
I've modified the pattern to
/Received:\sfrom\slocalhost\s\S+\s\S+\s+by\semail-test\.diylettering\.com\s\S+\s\S+\s\S+\s+id\s(\S+)/ Prepend X-DIYL: $1

It does not hit twice now.

I had to remove the anchoring at start (as you originally suggested), because for some reason it didn't hit then.

Thanks a lot, I owe you another beer

Reply via email to