0

I'd like to reject email from senders, but only for certain recipients. Example:

Sender [email protected] is blocked for [email protected]. Sender [email protected] is blocked for [email protected].

...

But all other recipients can receive mails from [email protected] and [email protected]. I am also using hosting multiple domains on the very same Postfix.

I found solutions like these https://dan.langille.org/2019/01/25/using-postfix-to-block-mail-based-on-from-sender-and-to-recipient/

They suggest using smtpd_restriction_classes. But this does not scale well, because if I would have to set 50 rules (sender-recipient pairs), I would need to create 50 files, with 50 classes. That's tedious.

Is there a better solution in Postfix?

2
  • You will find that what "scales well" highly depends on which software you can carry the operational cost for, possibly for years to come. I'd slap on a dead simple script, integrated through the policy daemon or milter interface. But if you already have something like rspamd or spamassassin setup in a suitable setup, you might instead want to put your complex rules there.
    – anx
    Nov 17, 2023 at 20:41
  • If your results are only "no match" and "reject", you should have a choice with the lookup order. If you think of your rules as per-recipient groups now and conclude you will need 50 restriction classes.. can you possibly think of your rules as per-sender groups and drastically fold the number of lookups for the recipient side because inside those subgroups the mapping can be expressed as one or few pcre patterns?
    – anx
    Nov 17, 2023 at 20:50

0

You must log in to answer this question.

Browse other questions tagged .