Postfix: Virtual Match All Domains EXCEPT One

postfix

I'm using Postfix 2.6.6 and accepting all mail to the server to go into one mailbox, like so:

main.cf:

mydestination = regexp:/etc/postfix/virtual_domains
virtual_alias_maps = regexp:/etc/postfix/virtual

virtual:

/@/ feedbacks

virtual_domains:

/.*/ MATCH

This works great, except it doesn't let mail go external, since it thinks it's all local. I'd like to get one domain, say, MYDOMAIN.COM, to be handled externally. What do I need to do differently?

EDIT: I want to elaborate on this question a bit. The server is set to handle mail for any incoming domains, through the setup I have listed above. However, as a result, it will not send any OUTGOING mail properly, since it thinks every domain is local to itself. How can I exclude a domain from the match and let it be handled normally?

Best Answer

When you say "go external" I assume you mean "go to a different mail server for final delivery", but still be handled by this host in some way.

If that's the case, I believe all you would need to do is modify the virtual_alias_maps file above to read something like:

#/etc/postfix/virtual file
/@example.com/  someother@place.com
/@/ feedbacks

since it's a regexp map, and thus, first match in the file wins.