let's say my domain is named "domain.tld" and the domain mails are hosted by a third party ISP so the MX record points to a ISP's public IP address.
I wanted to backup in a centralized place all the accounts incoming mails so I set an ISPConfig server in my office and configured on it the domain "domain.tld" and all the accounts also configured on the ISP mail server and then, I configured fetchmail to fetch periodically the incoming mail on the ISP accounts to te locals.
I also configured a special account where all the incoming mail are placed in by copy using the "always_bcc" postfix directive.
Now I want to use the ISPConfig server also as a SMTP Outgoing server for the clients inside my network.
To do that I provided the server with a public IP address and I configured the clients to use it.
The problem, of course, is that when a mail is sent from an internal account to another internal account, the ISPConfig server delivers it locally, without send it to the ISP, because the domain "domain.tld" is configured on ISPConfig.
I want to avoid this behavior and force postfix to send the mails to the public mx server, regardless of where the domain is hosted.
I tried to configure the domain itself inside the "mail routing" section, adding the domain as a new transport.
This actually works BUT it generates a mail loop to the ISP accounts:
The mail is sent to the ISP, then it is fetched by fetchmail and, once is fetched, it is automatically delivered again to the ISP, and so on for 5 or 6 times when the loop is blocked by the anti-loop system.
I then tried to add the lines:
to my master.cf file in the sections "smtp", "smtps" and "submission" but no luck.
Anyone can help me with this?
Thank you in advance.