If both postfix’ in your example are the same server, then that’s not possible indeed. Consider it has one brain, so it has to decide: Do I know this domain or do I need to send it upstream (either to the MX of the target domain, or to a configured relay).
In case it’s a domain postfix hosts, a delivery attempt will be made directly via LMTP/LDA. It does not go out (since it’s known local).
In case the domain is not hosted locally, it will be forwarded to a relay, and that has to decide where to send it next. If your machine is the best known option for the target domain, then it will be send there. But if that is the same postfix server, that’s an issue: because the domain is not known locally ,and thus it should be rejected. Message = lost.
In case you have 2 postfix instances, where A is on the top side of your image, then it can be configured to route all email to relay, and that has a configuration that send’s it to instance B (the bottom); that can have configuration that treats the target domain as local, and thus starts an delivery attempt to LMTP/LDA.
Does that help a bit?
Cheers Remko
On 2 Apr 2020, at 21:29, Adam Raszkiewicz <araszkiewicz@medallies.com> wrote:
So there is no way to skip Postfix for incoming messages and go directly to LMTP/LDA but I need two instances of Postfix in that case?
Regarding your second question - it is required to be complaint with Direct Trust.
Thanks, Adam
On 4/2/20, 3:07 PM, "dovecot on behalf of Juri Haberland" <dovecot-bounces@dovecot.org on behalf of juri@koschikode.com> wrote:
On 02/04/2020 15:18, Adam Raszkiewicz wrote:
Desired flow looks like:
Dovecot ---------------------> Postfix --> Relay Server -┐ Dovecot <-- LMTP/LDA <-- Postfix <---------------------┘
This mail flow cannot work with one Postfix instance. Either Postfix knows that "localdomain.com" is local and should be delivered to the LDA, in which case it won't be forwarded to the relay server, or Postfix does not know that "localdomain.com" is a local address and therefor forwards it the relay server, but than it will do that anytime it sees "localdomain.com".
Only possibility is to run two instances of Postfix.
The real question is: Why do you want this mail flow? Where is the benefit in sending a local mail out to a relay server only to get it back and deliver it?
Cheers, Juri