Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How could I block outgoing mail to a specific address using Postfix?

I've partially managed to block outgoing e-mail using header_checks. However, header_checks doesn’t cover BCC.

I also tested this solution: http://www.linuxmail.info/postfix-restrict-sender-recipient/ but it didn’t work.

share|improve this question
up vote 1 down vote accepted

As described in access(5), just add a check_recipient_access map to your smtpd_recipient_restrictions; if you wish to block these recipients for your own users too, make sure to place it before permit_mynetworks and/or permit_sasl_authenticated.

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

And in /etc/postfix/bad_recipients:

bad_user1@example.com REJECT We don't like him
bad_user2@example.org REJECT Delivery to this user is prohibited
share|improve this answer

We had a use-case for this scenario, where we needed to block some users receiving (opt-in) mailings from a list. Users that refused to press the "Unsubscribe" link in those user requested mailings (so, no, it wasn't spam). After a while we got abuse-mails from ISPs that got complaints from those weird lazy users, which was really time-consuming nonsense. So we decided to create a map for postfix. However, putting them in for a REJECT created new problems with the software sending them mail via postfix, so what we ended up doing was mapping this instead:

lazy_user@aol.com DISCARD Delivery to this user is ignored as a result of annoying abuse-responses from even lazier ISPs.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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