I've run into a problem with postfix I can't wrap my head around. Well, I sort of can and it makes sense to me but it can't be the way it's been designed...
- One central MTA for incoming and outgoing emails (Domain for incoming mails: @company.com; internal domain: site.com).
- Several remote servers located far far away from said central MTA handling different subdomains for their respective sites: city1.site.com, city2.site.com, location1.city2.site.com, location2.city2.site.com, city3.site.com, etc. Important notice: the local domain site.com is different from the official @company.com one and is only used internally.
- The mapping between external email adress firstname.lastname@example.org and the internal email@example.com is done via aliases on the central MTA.
- The internal destination hosts for city1.site.com, city2.site.com, etc. are defined via individual entries in transport, each site has its own local MTA. Thus, transport contains entries like "city1.site.com smtp:server.city1.site.com".
What I expect: 1) receive message; 2) remap external to internal address via aliases; 3) look up destination via transport; 4) deliver message
What it does: 1) receive message; 2) remap external to internal address via aliases; 3) look up destination via transport; 4) remap internal to external address via generic; 5) deliver message
The remote MTA receives these messages and immediately relays them because of an incorrect destination - the remote MTA's $mydestination is city1.site.com and not company.com. Thus, the message gets relayed back to the central MTA that serves as relayhost for all other MTAs and the entire game begins anew. After a few seconds I get a "too many hops" bounce and that's that. I absolutely do see the logic behind this in that step 4 in the latter case is, as far as postfix is concerened, a new message and not the original message anymore. The original message has been accepted by postfix and copied as new message destined for delivery. Thus, the process of remapping and delivery beings anew. However, this can't be the way it's designed so I'm fairly sure it's a layer 8 problem and I'm the stupid one here. How do I handle this problem, any ideas?