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

I would like to block every mail that is coming in from a domain that is running on my server.

Example: I have on my mail server and I'm getting a mail from outside with an email address of Then I know it's a Spam, because is on my server, so the sender cannot come from outside.

I want postfix to check for this, and simply block these kind of emails.

I know this is a function in postfix, just don't know which one.


share|improve this question
up vote 4 down vote accepted

Of course the sender can come "from outside"; you need to think carefully about what that actually means.

What if a user submits mail from outside your network ? You don't specify if this is possible.

This is easy if you use submission for all user submission of mail, and only use port 25 for inter-MTA traffic; in that case, simply disallow your local domains using a check_sender_access map:

smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination, check_sender_access hash:/etc/postfix/local_domains

and in /etc/postfix/local_domains: REJECT REJECT


Don't forget to postmap the file whenever you change it:

postmap /etc/postfix/local_domains   
share|improve this answer

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.