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?


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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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