Server Fault is a question and answer site for system and network administrators. 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 just want to catch all email sent to * AND * @ * to a unique email system@domain.Com

@runlevel6 Any idea to implement regexp in virtual like

cat /etc/postfix/virtual 

I found it:


virtual_alias_maps = regexp:/var/spool/postfix/plesk/virtual-sub

in virtual-sub

/[@.]example\.tld$/ sure@example.tld

thx runlevel6

share|improve this question
up vote 2 down vote accepted

Postfix supports the use of a catchall account using the luser_relay configuration option.

See the postfix page for luser_relay for more information.

When the local(8) delivery agent finds that a message recipient does not exist, the message is normally returned to the sender ("user unknown"). Sometimes it is desirable to forward mail for non-existing recipients to another machine. For this purpose you can specify an alternative destination with the luser_relay configuration parameter.

If it is not a catchall for all domains on the server you can instead user Virtual Aliases. See the postfix page for virtual aliases for more information. Short description and code excerpt from that page are as follows:

With virtual alias domains, each hosted address is aliased to a local UNIX system account or to a remote address. The example below shows how to use this mechanism for the domain.


virtual_alias_domains = ...other hosted domains...
virtual_alias_maps = hash:/etc/postfix/virtual

/etc/postfix/virtual: postmaster       joe      jane
# Uncomment entry below to implement a catch-all address           jim
...virtual aliases for more domains...

After making those changes, run postmap /etc/postfix/virtual and postfix reload.

EDIT: I think the regexp that you are looking for is /[@.]example\.com$/ system

You might need to make additional changes in to support this. See this post for more information.

share|improve this answer
thx will try it now. – chahedous Jul 17 '10 at 13:20
Any idea to implement regexp in virtual like cat /etc/postfix/virtual /[@*]$/ – chahedous Jul 17 '10 at 13:58
post updated with regexp and a link to a post on that has more information. – runlevelsix Jul 17 '10 at 15:45

Here's the settings to do a catch-all, but to an external server (I use this server as my smarthost for dev machines).

  • Replace with your server (we use exchange)
  • Replace with your destination for all emails that are sent to this box.
  • Replace the network with your dev network

postconf -e recipient_canonical_classes=envelope_recipient
postconf -e recipient_canonical_maps=regexp:/etc/postfix/recipient_canonical_map
postconf -e mynetworks=
postconf -e header_checks=regexp:/etc/postfix/header_checks
postconf -e

cat /etc/postfix/recipient_canonical_map

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.