Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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

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.