Relay local mail with Postfix
Solution 1:
This doesn't sound tehnically viable to route internal mails through smarthost, whatever the software is, and the only alternative I can think of is to use some sort of blind-carbon-copy that automatically copies all mails sent internally to an external address.
I have found this article from SpamExperts Knowledgebase, that deals with the same issue, (although it's with Exchange):
Microsoft Exchange internal email archiving
I'm going to quote it here:
When using SpamExperts for both your inbound and outbound email filtering (using the smarthost setup), all external SMTP communication will automatically be archived as part of the domain for which archiving is enabled. However Microsoft Exchange does not relay internal communication via the outgoing smarthost, therefore internal communication will not be archived by default.
Archiving internal communication is simple however, and can be accomplished with the Exchange journaling system. The journaling system allows Exchange to automatically send a copy of all internal communication to an external email address. As long as you've setup the external email address with SpamExperts for archiving, the SpamExperts inbound filter will simply process the message and archives it. You should configure the destination address to which the journaling reports are sent as a whitelisted blackholed recipient. This means for the messages received, no filtering or delivery to an external server takes place. SpamExperts support can help you accomplish this (or you can do so directly via the Software API on our Local Cloud product).
Your Microsoft Exchange administrator will be able to activate journaling for you, to ensure a copy of each email is automatically sent to the archived blackholed recipient.
Similar things can be achieved by using Postfix's sender_bcc_maps
and
recipient_bcc_maps
options. You may have a look at this for a hint:
How can I configure Postfix to retain copies of all email sent through it?
Solution 2:
As far as I know that it not possible. Postfix is unable to know wether that message is an "incoming" or an "outgoing" message, it just sees the message and tries to get it to it's destination. If you would manage to redirect the message (for example using a transport map), then postfix would produce an infinite loop with the other MX. Nobody wants that and that's why it's not possible. It might be possible to use a custom amavis script to achieve what you want but that's a rather dirty solution that might not always work as expected.