How to discard emails using the sender email address in Postfix

  1. Make list of email address/domains you wish to discard vi /opt/csw/etc/postfix/sender_access
       sender@example.com DISCARD
       DoNotReply@spam.example.com DISCARD
       subdomain.example.com DISCARD
       
  2. Hash table the file
       /opt/csw/sbin/postmap dbm:/opt/csw/etc/postfix/sender_access
       
  3. Add into the postfix config the smtp restriction line in
       vi /etc/opt/csw/postfix/main.cf
    
    smtpd_sender_restrictions = check_sender_access dbm:/opt/csw/etc/postfix/sender_access
  4. Reload postfix
    /opt/csw/sbin/postfix reload
Share