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

How to set Postfix configuration to cach-all emails in domain but excluding some addresses?


migration rejected from Jan 15 '15 at 14:57

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as off-topic by masegaloeh, Katherine Villyard, kasperd, mdpc, Ward Jan 15 '15 at 14:57

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

If you simply add the addresses you want to exclude from the catchall, they exist, are more specific and are used. Only if the envelope recipient is unknown, the catchall address is used.

If you want to block (reject) certain addresses without processing them at all, I can think of a smtpd_recipient_restriction (Postfix-Documentation).

You would add something like

smtpd_recipient_restrictions = 
    check_recipient_access hash:/etc/postfix/rcp_access

And in the file rcp_access (run postmap rcp_access to create the hashed file)     REJECT


And there is the not optimal way of adding a line like

/^To:.*    REJECT

to your /etc/postfix/header_checks file.

seems to be great idea but it doesn't work – Kamilos Apr 15 '11 at 9:54
Without further investigation why it doesn't work, I can also think of adding a line to the header_checks file. – initall Apr 15 '11 at 10:02
OK. If I tests it with… it seems works, but when i sent mail it was delivered. To catch-all I use "" in virtual_maps after existings aliases, but maybe is other way? – Kamilos Apr 15 '11 at 11:10
When you send mail you may receive it because you authenticated or sent within your local net: if this is permitted before the check_recipient_access restriction, it is possible. If you implemented the header_checks method, you have to add a similar line to a smtp_header_checks file. The first one is a filter while receiving mails, the latter a filter when mail is delivered. – initall Apr 15 '11 at 11:42
You may be right. I will test it later from other location. – Kamilos Apr 15 '11 at 12:10

I had to configure one of my postfix installation to do just that:


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