Other option also would be to use antispam solutions and write such rules
there, they allow much more complex logic and if your intention to prevent
spam - antispam system that has sane defaults is good choice. Postfix can
work with any milter compatible antispam like Rspamd or SpamAssassin. I
personally would recommend look at Rspamd as it HA, designed better than
SA, has much more functions.

On Tue, 15 Apr 2025, 16:50 Wietse Venema via Postfix-users, <
postfix-users@postfix.org> wrote:

> Alex via Postfix-users:
> > Hi,
> > I have a fedora40 system with postfix-3.8.5 and would like to configure
> > header checks depending on the domain. Perhaps there is some kind of
> > conditional that can be used based on the sending domain?
> >
> > For example:
> >
> > if recip-domain == example.com
> > /^From: u...@baddom.tld/ REJECT spam
> > fi
>
> For multi-criteria rules use an smtpd_milters milter-regex plugin.
>
> Example:
>
> /etc/postfix/main.cf:
>     smtpd_milters = inet:127.0.0.1:9999
>
> /etc/mail/milter-regex.conf:
>     reject
>     header /From/ /^user@baddom\.tld$/i and envrcpt /@example\.com$/i
>
>     Specify the "i" flag to make the pattern case-insensitive, and
>     specify the "e" flag to enable "extended" POSIX syntax (enable
>     "(" and ")" for grouping, "|" for alternatives, and "+" for
>     one-or-more).
>
> [Plus some systemd or rc file syntax for milter-regex start-up]
>
>         Wietse
> _______________________________________________
> Postfix-users mailing list -- postfix-users@postfix.org
> To unsubscribe send an email to postfix-users-le...@postfix.org
>
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to