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.

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

share

migration rejected from stackoverflow.com Jan 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 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.

2 Answers 2

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)

rejectme@example.com     REJECT

[Edit]

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

/^To:.*foo@example.com/    REJECT

to your /etc/postfix/header_checks file.

share
    
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 my-addr.com/free-email-verification-tool/verify-email-address/… it seems works, but when i sent mail it was delivered. To catch-all I use "@domain.com" 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:

http://www.rwahyudi.com/linux/postfix-for-dev-setup-%E2%80%93-catch-all-email-and-forward-it-to-a-specific-address

share

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