I am having Postfix installed mailserver and I am using that server for legitimate purpose only.

I need to block some outgoing emails for a particular blacklisted domain. Is there anyway to do through the configurations ?

Your help is greatly appreciated.

Thanks in advance Karthick


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
baduser@bad.domain3    REJECT

Don't forget to postmap that file.

  • This does not work for TLDs (example: .biz, .info) – Overmind Aug 20 '18 at 11:25
  • This works from Thunderbird, I blocked some email addresses and I get an error. However, when sending from PHP, the emails go through. How do we also block the PHP mail() (mine is setup to use SMTP). – Alexis Wilke Mar 14 '20 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.