Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've set up a Postfix SMTP server on my Debian server and configured it to forward emails to my main email address using the virtual_alias_maps option. Sending and receiving emails works fine and emails addressed to non-existing users are rejected.

However, there are several users on the server that should not be able to receive emails. Is it possible to configure Postfix to reject emails to any user that is not mentioned in the virtual alias list (or some separate list, if that's easier)?

I've found some information on rejecting emails to specific users, but it would be much easier if I didn't have to add every user to a blacklist.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

Have a look at http://www.postfix.org/LOCAL_RECIPIENT_README.html for an answer. (Specifically look at the Local recipient table format).

IE, create a map with local recipients you want to receive email, add/modify the local_recipient_maps configuration variable to read from that file. (There are a number of ways of doing this, depending on your requirements - I tend to store mine in a database, but for a small system, just create a text file called /etc/postfix/local_recipientlist with the contents:

username@domain.name   exists
username2@domain.name  exists

Then run postmap /etc/postfix/local_recipientlist (And specify local_recipient_maps=hash:/etc/postfix/local_recipientlist in main.cf)

share|improve this answer
    
Works perfectly, thank you for your help. –  n.st Feb 11 '13 at 13:13
add comment

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.