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.

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 person@fromaddress.com to person@ouraddress.com should be black listed, but not other emails coming from person@fromaddress.com.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

You could use restriction classes. See:

For example:

/etc/postfix/main.cf:
    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:
    person@fromaddress.com   REJECT   You are not welcome here.
    ...

/etc/postfix/protected_destinations:
    person@ouraddress.com    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

 
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.