Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

I have a scenario where I need to blacklist emails from one email to one of our local emails. Is blocking this specific scenario possible in postfix?

For example, emails from to should be black listed, but not other emails coming from

share|improve this question
up vote 6 down vote accepted

You could use restriction classes. See:

For example:

    smtpd_recipient_restrictions =
        check_recipient_access hash:/etc/postfix/protected_destinations
    smtpd_restriction_classes = bad_senders1
    bad_senders1 = check_sender_access hash:/etc/postfix/bad_senders1

/etc/postfix/bad_senders1:   REJECT   You are not welcome here.

/etc/postfix/protected_destinations:    bad_senders1

Now emails with an envelope sender address in the "bad_senders1" restriction class will get rejected, but only if it was sent to an address in the "protected_destinations" list that has the "bad_senders1" restriction class specified on the right-hand side.

Remember to run postmap for the newly created files.

share|improve this answer
Great answer, thank you, exactly what I needed. – Deeksy Feb 28 '11 at 10:13

Your Answer


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.