Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

I tried adding a rule to /etc/aliases which would send a message to /dev/null if it was sent to a particular alias:

fooname: /dev/null

I have postfix set up with a default address for a particular domain in my /etc/postfix/virtual file:

@mydomain.com  realuser

I have multiple domains mapped to this server. I've found that if I send a message to "fooname@mydomain.com, realuser@mydomain.com, fooname@otherdomain.com, realuser@otherdomain.com" I will receive the first, second, and fourth messages, but I won't receive the third.

The upshot is that entries in /etc/aliases don't seem to short circuit the email sending.

How do I send messages for particular aliases to /dev/null while still keeping the default alias?

share|improve this question
up vote 2 down vote accepted

Sorry to answer my own question again, but after a couple hours of struggle I figured out what to do:

First, I added the following to the main.cf:

smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/access_usernames, permit_mynetworks, reject_unauth_destination

Then I added entries like the following to the access_usernames file:

badaddress@    REJECT

Then I did "postmap access_usernames" and "postfix reload".

The access_usernames file can contain any number of email addresses to reject and it seems to work fine with the default alias!

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.