ATM I'm using the normal method to put all messages on HOLD to pass them from postfix to MailScanner as described on http://www.mailscanner.info/postfix.html:
In the Postfix configuration file /etc/postfix/main.cf add this line:
header_checks = regexp:/etc/postfix/header_checks
In the file /etc/postfix/header_checks add this line:
The effect of this is to tell Postfix to move all messages to the HOLD queue.
But I have some SMTP message that I have no need to pass them through MailScanner, messages identified by a custom header. I need to find a way to bypass MailScanner for these messages, but I can't find it, given I need to check the presence of a custom header and not i.e. the From: or To: address...
Tried modifying /etc/postfix/header_checks:
/^X-Custom-Header:/ FILTER smtp:[ip.addr.next.hop]:10025
in the mail.log I see the message filtered:
Aug 19 17:52:17 servername postfix/cleanup: AFB842E33A: filter: header X-Custom-Header: from relay.sender.foo[xx.yy.zz.kk]; from=<firstname.lastname@example.org> to=<email@example.com> proto=ESMTP helo=<mail.sender.foo>: smtp:[ip.addr.next.hop]:10025
and if the one above is the only rule in header_checks it's delivered to the next hop via smtp.
Now I need to catch everything else in the Mailscanner (so in the Postfix HOLD queue), so how can I tell header_checks to do that? If I leave the /^Received:/ check even the AFB842E33A is held in the HOLD queue...
Maybe is just a dumb question, but... any idea?