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 have installed postfix+dovecot+mysql. Everything works fine. But I need to do one specific thing:

If a user doesn't exist (e.g. idontexist@mydomain.tld), then the message needs to be forwarded to google apps. I need to the forward original message (like it was send to g-apps directly), not forward it to some bin@g-apps.

Can somene point me to the solution?

share|improve this question
Are you going to serve in such way local users (i.e. mydomain.tld is in your 'mydestination' in or virtual users? – Vadym S. Khondar Mar 28 '12 at 12:26
Only virtual users. – DominikM Mar 28 '12 at 12:28
And what do you mean under 'send to g-apps directly'? Forward original email to specific email address? – Vadym S. Khondar Mar 28 '12 at 12:42
Do not accept mail you cannot deliver. – adaptr Mar 28 '12 at 13:10
Do the MX records for mydomain.tld point to the postfix server or Google? – adamo Mar 29 '12 at 8:18
up vote 1 down vote accepted

DISCLAIMER: I take no responsibility for the undeliverable bounce messages that will get stuck in your mailqueue as a result of this. adaptr's comment is correct; you should only accept mail you can deliver. Ideally, you should check against the google-apps domain to see if a recipient is valid. If at all possible, do that.

You can use a Perl Compatible Regular Expression's table using TEXT SUBSTITUTION as your last virtual alias map.

share|improve this answer

You can setup catch-all account in your virtual_alias_maps file.

But this would open a hole for lots of spam.

See for details.

share|improve this answer
I know about catch-all account. I have one now, but it can be (as far as i know) used only to redirect to specific mail address => Mail originally to bar@mydomain.tld is redirected and send to redirect@another-domain.tld. But what i want is redirect it to google apps account like there is no postfix and redirection. Thank you – DominikM Mar 28 '12 at 13:23
What do you mean under 'redirect to google apps account'? – Vadym S. Khondar Mar 28 '12 at 13:54
Customer has google apps on his domain and uses it for e-mails. Now he want to use his server (postfix, etc...) as mail server, but only for specific accounts and the users not listed in virtual users on his server should be "redirected" (as i described befeore) to google apps, which he uses now. Is it possible to do this? Thanks. – DominikM Mar 28 '12 at 14:15

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.