On Thu, Feb 13, 2020 at 02:56:32PM -0500, Wietse Venema wrote: > Linux Addict: > > > The smtp recipient/header checks seems to parse line by line so I can > > discord to noreply, but how do add a condition. I looked if.. endif, but I > > am unsure how to get this done with from and to lines in one regex. > > Headers are not a good way to determine where email is being sent > to. The recipient is part of the envelope. It is sent with the RCPT > TO command. > > /etc/postfix/main.cf: > smtpd_recipient_restrictions = > ... > reject_unauth_destination > check_recipient_access inline:{{nore...@example.com = discard}} > ...
Note that "discard" is a "message-level" action, so the mail would also not be delivered to any other Cc'd/Bcc'd recipients. To discard email addressed to just one recipient: virtual: lu...@example.org luser=example.com@discard.invalid transport: discard.invalid discard:silently There isn't yet an access(5) primitive that discards just the *current* recipient, that can be selected on a combination of criteria via nested restriction classes. So I'd use the access(5) "DISCARD" action with great caution, basically for malware or an unusual flood of mail, ... In most other cases, deliver or reject. But delivery to the discard(8) transport of a *particular* recipient that is advertised to not receive mail is fine. That's what the avoid rewrite and transport rules do. -- Viktor.