If you want to design a solution that can reject the messages during SMTP connection (before accepting any data) based on your criteria (sender AND recipient), you need check_policy_service in Postifx. http://www.postfix.org/SMTPD_POLICY_README.html
For large scale, you may use almost any programming or scripting language and a database. For you particular case, I would go with Redis db. -----Original Message----- From: owner-postfix-us...@postfix.org [mailto:owner-postfix-us...@postfix.org] On Behalf Of Barbara M. Sent: Thursday, May 14, 2015 5:41 PM To: Tom Hendrikx Cc: postfix-users@postfix.org Subject: Re: RegExp help On Thu, 14 May 2015, Tom Hendrikx wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > On 14-05-15 12:48, Barbara M. wrote: >> >> I am trying to use regexp to block mails from specific domains to >> specific users (and let other users receive it). >> >> I need to merge (logical AND operator), something like: >> >> /^From:.*\@.*domainsource.tld/ REJECT No Unrequested mail >> Please /^To:.*\@.*domaindest.tld/ REJECT No Unrequested mail >> Please >> >> For my needs I want these rules evaluated in AND. >> >> How can do this with a valid rules in my >> /etc/postfix/header_checks? If there is a better solution ... ;-) > > Header checks doesn't do AND for multiple headers, all headers get > evaluated separately. For this idea, you'd need a content filter. So it isn't so trivial as I thought ... :-( > Within Spamassassin these kind of rules are trivial. I use SA in default config. Never tried to customize rules, so, may be it isn't trivial for me. :-) N.B.: I want mail rejected from Postfix not marked as spam and delivered. If SA can do this I try it (better if someone give me some example/hints for the .cf ;-)) Thanks, B.