postfix filtering

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

postfix filtering

soumitri@iitk.ac.in
Hello,

In Postfix, I want

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.


I also want to know

3) The best practices with postfix, any URL will help.

4) Any  recent postfix version 3 book in English with .

5) Best  external mail filtering open source software for postfix.


Thanks for any help.

--
Sincerely
Soumitri Mishra
http://home.iitk.ac.in/~soumitri/

Reply | Threaded
Open this post in threaded view
|

Re: postfix filtering

Noel Jones-2
On 8/14/2017 5:28 AM, [hidden email] wrote:
> Hello,
>
> In Postfix, I want
>
> 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.


> I also want to know
>
> 3) The best practices with postfix, any URL will help.

http://www.postfix.org/documentation.html

> 4) Any  recent postfix version 3 book in English with .

I'm not aware of any books specifically covering postfix version 3.
However, there are good books on postfix version 2 that are still
excellent for a beginner.
"The Book of Postfix" by Hildebrandt and Koetter is a great place to
start if you can find it.  "Postfix: The Definitive Guide" by Dent
is also good.

Unfortunately for writers, postfix evolves pretty quickly. This
makes it impossible to keep a print copy anywhere close to current.

The best documentation is the postfix web site, which Wietse spends
a great deal of effort keeping current and correct.
http://www.postfix.org/documentation.html

> 5) Best  external mail filtering open source software for postfix.

This is a very subjective question.  "Best" varies based on your
goals and skill level.  I like amavisd-new running pre-queue with
smtpd_proxy_filter or amavisd-milter, but some people are
overwhelmed by the great number of config options.
https://www.ijs.si/software/amavisd/


Good Luck!




  -- Noel Jones
Reply | Threaded
Open this post in threaded view
|

Re: postfix filtering

soumitri@iitk.ac.in
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
Reply | Threaded
Open this post in threaded view
|

Re: postfix filtering

Noel Jones-2
On 8/14/2017 1:31 PM, [hidden email] 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