Istvan Prosinger: [ Charset windows-1252 converted... ] > On 19.3.2016 1:18, Wietse Venema wrote: > > Istvan Prosinger: > >>>> Why a separate header, why not just: > >>>> > >>>> enable_long_queue_ids = yes > >>>> > >>>> and use the queue ID that's already in your top Received: header? > >>> > >>> I would use a header_checks PREPEND action that prepends a header > >>> with the long queue ID from the Received: header. > >>> > >>> Sorry, no time to write out a complete example. > >> > >> Thanks. > >> > >> Ok, I was thinking of this, but wasn't sure how to "pass" the (long or > >> not) queue ID (or anything else) in header_checks. Another thought is to > >> copy one that is already there, but not sure how to do it or how far can > >> I go in a "one-liner" > > > > /etc/postfix/main.cf: > > enable_long_queue_ids = yes > > header_checks = /etc/postfix/stamp.pcre > > > > /etc/postfix/stamp.pcre: > > # Pattern for /usr/sbin/sendmail submission > > /^Received:\sby\sserver\.example\.com\s\S+\s\S+\s\S+\s+id\s(\S+);/ > > Prepend X-ID $1.server.example.com > > > > # Pattern for SMTP submission > > > > /^Received:\sfrom\s\S+\.example\.com\s\S+\s\S+\s+by\sserver\.example\.com\s\S+\s\S+\s\S+\s+id\s(\S+);/ > > Prepend X-ID $1.server.example.com > > > > Wietse > > > > > Thanks for the ideas. I need to mark the incomming mails for local > storage tracking, not submission, so anyway, I ended up with a shorter > version > > /name\.server\.com\s\S+\s\S+\s\S+\s+id\s(\S+)/ Prepend X-DIYL-$1
I recommend starting the pattern with /^Received:.*by name\.server\.com.../ That way it won't have to inspect non-"Received:" headers. > And added to > smtpd_recipient_restrictions = check_recipient_access > pcre:/etc/postfix/stamp.pcre > > I'm quite sure that I have a match on the queue id, but the Prepend has > no effect on the header. What am I missing? Test with: postmap -h pcre:/etc/postfix/stamp.pcre < file where the file contains an email message with Received: headers. Wietse Wietse