On 4/16/2019 5:05 AM, Dominic Raferd wrote:
On Tue, 16 Apr 2019 at 10:25, Nick Howitt <[email protected] <mailto:[email protected]>> wrote:On 13/04/2019 09:26, Andrey Repin wrote: > Greetings, Nick Howitt! > >> I am receiving some not very nice spam and I was wondering if I could >> use as a single filter: >> To: contains mydomain >> From: is the same as To: (inside < and >) >> Return-Path: is not from my domain >> Or am I using completely the wrong tool for this? > If you search list archive, you'll find that each check made by postfix is > made in isolation, if you want some complex rules, you'd need a milter. > > Thanks Andrey, I thought the checks were line by line and you've confirmed it. I've had a quick look at writing milters and that one is beyond me for the moment.Look at postfwd milter (http://postfwd.org/), where a single rule can combine tests on different headers.
postfwd is a policy service (not a milter), and doesn't see headers. It *can* combine tests on multiple envelope items, such as client, mail from, and rcpt to.
If you need arbitrary header checks, milter-regex can do complex regular expression matching on multiple headers or the body of the message. See google for examples.
-- Noel Jones
