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

Can I set up a virtual domain on one box so that a few specific email addresses get forwarded to gmail, and everything else (using a wildcard) goes to another system I control? For example, can I put in /etc/postfix/virtual
* *
share|improve this question
up vote 4 down vote accepted

You can do this for a wildcard:

(ie. what you had without the asterisks). From the VIRTUAL(5) documentation:

#        The lookup result is subject to address rewriting:
#        o      When  the  result  has  the  form @otherdomain, the
#               result becomes the same user in otherdomain.   This
#               works only for the first address in a multi-address
#               lookup result.
share|improve this answer
The problem with the catch-all approach is that it'll unfortunately also forward all the emails that are sent to random usernames at that specific domain. IME 99% of those emails are spam... – Timo Geusch May 7 '09 at 16:38

Yes, but wildcard rewriting defeats address validation. The usual disclaimers about catchall addresses apply in that case.

The usual advice, if you have a list of known/valid addresses, is to let the computer do the work for you and generate /etc/postfix/virtual from your database of known addresses (or use a database maptype). Make(1) is your friend.

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.