This shouldn't really be a big problem to do both, especially since you are using Postfix. The big question I have is this. You say you want messages being forwarded out to the internet; where are these messages coming from? A process on the same machine? An internal network? You aren't setting this up as an open relay, are you?
Now really, the only thing that should be going to the primary mail server are emails for domains that it is authoritative for; i.e. the primary MX record destination.
The relay portion from my first paragraph needs answers before anyone can help you with that part of the config. As far as being the secondary mx for domains, that's as simple as setting them in the
relay_domains parameter:
Code:
relay_domains = example.com , example2.com ,
hash:/path/to/file/of/domains , ldap:/path/to/ldap/config
It is recommended to also specify a
relay_recipient_maps entry if at all possible to go with
relay_domains. This is a list of all the valid addresses for each recipient. That way, you won't be a source of backscatter since, with just the
relay_domains specified, Postfix will accept mail for any address at the domain and then end up bouncing the message if the user doesn't exist. See "man 5 postconf" and read the section for "relay_domains" and "relay_recipient_maps" for more info.