Because it's a long time problem with VHCS, and later iscpCP Omega and finaly i-MSCP, I will try to explain very clearly my purpose.
On my i-MSCP server, I generaly don't use local mail server.
Instead, I'm using an external webserver.
In my experience, it's very boring to manage problem on a mail server (or migrate mailbox), so I prefer externalize this service to a trust compagny
The problem, with i-MSCP, is when the server has to sent a mail to a domain hosted by itself (for example, after a form validation or when you ask a password reset).
You can easily reproduce the problem by sending manually an email from ssh console :
... where mydomain.com is hosted by i-MSCP, but the mailbox firstname.lastname@example.org doesn't exist on this server, but elsewhere, at an external provider.
On the log, you will have :
I dream (from long time ago) of a fonctionnality to set an option like this to a domain : "Don't use local MX for this domain. Send the mails outside, to the Internet"
I try to use the option "external mail server" without success because my external smtp server need an authentification (Nuxwin said he will help me to test this option with a hook )
But in my opinion, it could be more simple to just say "lest go the mail outside with local smtp server, and trust the internet to find the good MX".
I really need a solution to do this king of stuff.
For now, I have found a durty roundabout : if I need to send a mail to email@example.com from the server (where mydomain.com is hosted by i-MSCP), I create a mail redirection elsewhere from firstname.lastname@example.org to email@example.com (where otherdomain.com IS NOT on the i-MSCP server)
But is not easy to ask your customer to use this durty tip