Error sending mail to VPS with external mail

SYSTEM INFORMATION
OS type and version CentOS Linux 7.9.2009
Webmin version 2.105
Virtualmin version 7.9.0

I have on same server one virtual server (say domainA) that has external (MS Exchange) mail server and on this VS the feature “Mail for domain enabled” is unchecked. And I have another VS (domainB) that uses Postfix mail server and when mail@domainB tries to send email to mail@domainA it gets error

SMTP Error (550): Failed to add recipient “mail@dimainA” (5.1.1 mail@domainA: Recipient address rejected: User unknown in local recipient table).

Hello @vidma and welcome to the community.

This behavior is as if “Mail for domain enabled” is checked; assuming mail@domainA exists on the Exchange server.

Is it being delivered locally and therefore bouncing? Use the Virtualmin → Disable and Delete → Disable virtual server to disable the domainA virtual server for a minute and then try and send mail from mail@domainB to mail@domainA - does is get delivered successfully now that Virtualmin has nothing to do with domainA since you have just disabled it?

Else check the mail logs to see where the mail is attempted to be delivered.

Has disabled domainA virtual server (and all subdomain.domainA virtual servers), restarted VPS but the problem still persist.

15 07:09:21 domaina postfix/smtpd[3661]: NOQUEUE: reject: RCPT from localhost[::1]: 550 5.1.1 : Recipient address rejected: User unknown in local recipient table; from= to= proto=ESMTP helo=
May 15 07:09:21 domaina postfix/smtpd[3661]: disconnect from localhost[::1]

By the way, to any other email (exept domainA) it sends messages.

maybe try nslookup to query the MX records for domainA to make sure the MX records are pointing to the exchange server.

it points correctly domaina-external.mail but for some reason the domainB on same vps is trying to send email to VPS mail server and not to external mail server. And it seams that somthing is on domainB virtual server as even I disable the domainA virtual server it still try to send it internally.

Any other email (outside the VPS) sent to domainA enters the mailbox (on external serever), and any other email sent from domainB leaves the server.

Are you using Virtualmin DNS or some other DNS server for domainA?

Yes, DNS domain is enabled as I host the website on virtual server but the mail server is external and pointed trough MX record.