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.

link|improve this question
feedback

1 Answer

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.

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

Your Answer

 
or
required, but never shown

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