I need to run all mail addressed to local domains (as defined in vmail_domains) through a simple after-queue content filter which then re-injects the processed emails back into Postfix via sendmail.
I have successfully created a perl filter based on the example of a simple after-queue content filter shown in the postfix FILTER_README doc:
smtp inet n - n - - smtpd -o content_filter=statusFilter
statusFilter unix - n n - - pipe user=mailFilter argv=/mydir/filter.pl ${sender} ${recipient}
Unfortunately, that filter only filters the mail arriving via the internet and misses all of the local deliveries such as Postfix bounce messages, and I especially need to process the bounce messages, regardless of how they arrived.
Is there some way for all email addressed to local Postfix domains be filtered with a simple after-queue filter, regardless of whether it arrived from a local source or a remote source, while never filtering any mail being sent to remote (internet) domains?