I configured a postfix virtual machine in Azure to act as a relay host for outgoing emails of my Office365-Exchange online hosted domain, because I had to replicate my old on-premise architecture, where there was an Exchange server with a postfix relay. This relay makes some transformation on sender addresses of outgoing emails, following my company policies. Office365-Exchange online is configured with a connector to route all outgoing emails to that Postfix VM on Azure.
On premises setup worked without problems for years. Now that I replicated that setup on Exchange online + Azure postfix VM, the mail flow works without problems, except for recipient domains that are also hosted on outlook.com domains. Every mail sent is bounced with this error:
host xxx-xxx.mail.protection.outlook.com[X.X.X.X] said: 554 5.4.14 Hop count exceeded - possible mail loop ATTR1 [xxx-xxx.prod.protection.outlook.com] (in reply to end of DATA command)
Do you have any clue?
Edit: We are still facing the problem, but I have more details:
Not every mail sent to any Office365 domain is bounced with the loop error, only mails sent to domains that have the same *.outlook.com server that we have: searching in postfix logs, i found that our emails are going out from 3 outlook.com servers, with 3 different IP addresses; I found the same and only 3 IP addresses in error logs related to the bounce error.
Here is an example, IP addresses are all fake:
mycompany-com.outlook.com [104.1.2.3] -> Postfix relay [54.1.2.3] -> recipient_first-com.outlook.com [104.1.2.3] = Bounce error
mycompany-com.outlook.com [104.1.2.3] -> Postfix relay [54.1.2.3] -> recipient_second-com.outlook.com [104.4.5.6] = mail sent correctly
When my outgoing outlook server and the recipient incoming server have the same IP address, the error occurs.