I’m not sure what exactly happens with mail, so just about DNS… If the scanner uses router as DNS resolver, you can either:
a) Add static record server4.mycompany.local in “/ip dns static”. It would not update automatically, but server addresses usually don’t change often, so it could be good enough.
b) Use L7 hack to redirect mycompany.local to the right nameserver.