Reject / Discord mails coming to specific users

aestech

New Member
Dec 20, 2025
1
0
1
example.com is one of the domains in my PMG. The mail server is hosted on WHM with Exim. The server does not have the mailbox unknown1@example.com. (this happens to multiple mailboxes on same domain).
How can I discard or reject emails sent to unknown1@example.com before DNSBL checks are performed, so we can avoid unnecessary queries to DNSBL providers? If we can't skip DNSBL, what is next to block ?

Is there a way to do this?
 
Welcome @aestech

In a vanilla Postfix I create a file named for instance /etc/postfix/block_recip
with lines like

unknown1@example.com REJECT
unknown2@example.com REJECT

Then I execute postmap hash:block_recip
(which creates/updates the file /etc/postfix/block_recip.db )

Then in /etc/postfix/main.cf in the section smtpd_recipient_restrictions =
I put the line (in the proper order - it depends on the logic sequence of restrictions in this section):

check_recipient_access hash:/etc/postfix/block_recip

(mind: without .db at the end of the filename).

Then I postfix check and postfix reload.

Disclaimer: I don't know if such addon doesn't interfere negatively with Proxmox Mail Gateway general configuration.

P.S. Later, when you update the block_recip file, you must again issue postmap hash:block_recip
and reloading postfix is not needed.
 
Last edited: