Access to IMAP

Hi all,
We are using a local mail server and access it via lan and via a mikrotik router. All the desktop computers and mobile phones access the mail server via imap on port 993. The problem is that the phones, given their mobility, need to access the server using mail.xyz.com as the external name domain (as opposed to a local lan address) which works fine whilst on the cellular network. However once the mobile phones access the local wifi of our office, connection to the imap server drops leading to no access to the mail server. Furthermore there is no access to the webmail server from within the lan network using any lan connected pc. Any help?

You need to apply hairpin nat OR add a local static dns entry pointing to your internal server.

https://wiki.mikrotik.com/wiki/Hairpin_NAT

thanks nescafe, I owe you a cup of coffee !
worked like a charm !