PGNet Dev:
> I've set up a postfix instance
>
> [127.0.0.1]:10003 inet n - n - - smtpd
> -o syslog_name=postfix/after-filters
> ...
> -o
> receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_address_mappings,no_milters
> -o content_filter=relay-internal:[internal-mx.example.com]:10001
>
> which relays after all pre-queue filters, and final queuing via
>
> relay-internal unix - - n - - smtp
> ...
>
> Mail flows as intended.
>
> I'd like to do a final pcre header check BEFORE doing the relay,
> REJECTing on match of a X-Spam-Level header if/when set by ANY
> prior, pre-Q filter.
Postfix has milter_header_checks for message headers
that are added by a Milter.
Wietse
milter_header_checks (default: empty)
Optional lookup tables for content inspection of message headers that
are produced by Milter applications. See the header_checks(5) manual
page available actions. Currently, PREPEND is not implemented.
The following example sends all mail that is marked as SPAM to a spam
handling machine. Note that matches are case-insensitive by default.
/etc/postfix/main.cf:
milter_header_checks = pcre:/etc/postfix/milter_header_checks
/etc/postfix/milter_header_checks:
/^X-SPAM-FLAG:\s+YES/ FILTER mysmtp:sanitizer.example.com:25