Postfix equivalent of Exim :fail: for virtual aliases

pwaring asked:

I’m in the process of migrating an existing mail setup from Exim to Postfix, which involves multiple virtual domains (i.e. they’re not tied to the machine name or local system accounts).

I’ve come across a few entries in /etc/aliases which look like this:

aliasname: :fail: Failure message

If I email aliasname@example.org I get a bounce with 550: Failure message. Effectively these aliases are addresses which are no longer used but provide a slightly more useful error message instead of just deleting the alias.

Is there equivalent functionality available for Postfix?

My answer:


These can go in the Postfix access table.

For example:

username@       REJECT Go away, we don't want any

or

username@domain 550 5.1.1 Are you daft? Stop mailing here. They died in a fire.

But be aware that this will match either sender or recipient addresses, depending on when you call it from main.cf. To check the recipient address, add to smtpd_recipient_restrictions:

            check_client_access hash:/etc/postfix/access,

It can filter on much more than email address, so you will probably have more than that to add to it.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.