Postfix - how to block emails sending out to a particular domain

Solution 1:

A closer look at the basic access controls available should help you out; just specify the appropriate access map in smtpd_recipient_restrictions that denies access to those domains:

smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/blacklisted_domains, permit_mynetworks, reject_unauth_destination, permit

and in /etc/postfix/blacklisted_domains:

bad.domain1    REJECT
bad.domain2    REJECT
[email protected]    REJECT

Don't forget to postmap that file.