This can occur when you replace the default self-signed Exchange Server 2007 certificate with a different certificate.
This is because the Setup program in Exchange Server 2007 creates a default self-signed certificate when Exchange Server 2007 is installed.
By default, the URL that is stored in these objects references the NetBIOS name of the server. For example, a URL that resembles the following URL is stored:
https://NetBIOS_Name.yourdomain.local/autodiscover/autodiscover.xml
This may differ from the host name that is used in the FQDN of the replacement certificate.
For example, the replacement certificate may have an FQDN that resembles the following FQDN:
mail.yourdomain.com
This issue causes a name mismatch error to occur. Therefore, you receive the security warning message when you try to connect Outlook 2007 to the mailbox.
To fix it, In Powershell run
Set-ClientAccessServer -Identity Your_CAS_Server_Name -AutodiscoverServiceInternalUri https://mail.YOURDOMAIN.com/autodiscover/autodiscover.xml
Set-WebServicesVirtualDirectory -Identity “Your_ CAS_Server_Name\EWS (Default Web Site)” -InternalUrl https://mail.YOURDOMAIN.com/ews/exchange.asmx
Set-OABVirtualDirectory -Identity “Your_ CAS_Server_Name\oab (Default Web Site)” -InternalUrl https://mail.YOURDOMAIN.com/oab
Set-UMVirtualDirectory -Identity “Your_ CAS_Server_Name\unifiedmessaging (Default Web Site)” -InternalUrl https://mail.YOURDOMAIN.com/unifiedmessaging/service.asmx
Open IIS Manager.
Expand the local computer, and then expand Application Pools.
Right-click MSExchangeAutodiscoverAppPool, and then click Recycle.
Done.