This will happen when your mail server uses a certificate that does not match the name you are using - example: - you use mail.mydomain.com but the certification is for srv06.hostmaster.com. To fix it, you can either use the server name that matches the certification or use HOSTS file to fix it.
I have more information and the steps to create a hosts file in this article: https://www.slipstick.com/outlook/security-warnings-in-outlook