On 8/14/2017 1:31 PM, soumi...@iitk.ac.in wrote: > Thanks for the precise replay. > >>> 1) Copy all emails containing specific pattern in body to another >>> email id, but all recipients in that will get the mails as usual. >>> >>> 2) Redirect all emails containing specific pattern in body to >>> another mail relay. >> Postfix header_checks and/or body_checks can probably do what you >> what. See the BCC, FILTER, and REDIRECT actions to decide what you >> need. >> http://www.postfix.org/header_checks.5.html >> >> Be aware that header_checks and body_checks only sees the "raw" >> email; there is no decoding of HTML or quoted-printable or base64 >> text. For more complete control, use a milter. > > Sorry, my question missed that it was the filtering primarily for > outgoing mails (i.e. smtp_body_check). > and as per the man page for BCC,FILTER and REDIRECT action "This > feature is not supported with smtp header/body checks". > Addition to this, with body_check I can not add more that one email > id in BCC/REDIRECT. And I can not redirect the "matching pattern > mail" to another server for further analysis. > > This is why i was thinking of external mail filters. apologies, if I > am wrong here in reading. > > With Regards, > Soumitri
All mail enters postfix before it exits postfix. Filter your mail as it comes in to postfix with normal header/body checks. Milters and other external filters also generally work during input, not output. If you need to restrict these rules to "outgoing" mail only, use a separate postfix instance for submission. http://www.postfix.org/MULTI_INSTANCE_README.html -- Noel Jones