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:
/^Received:/ HOLD
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[19423]: AFB842E33A: filter: header X-Custom-Header: from relay.sender.foo[xx.yy.zz.kk]; from=<sender@senderdomain.foo> to=<me@mydomain.foo> 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?