Mail Fetching issue due to Unrecognized SSL exception!

Mail Fetching issue due to Unrecognized SSL exception!


Error Trace:

javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at com.sun.net.ssl.internal.ssl.InputRecord.handleUnknownRecord(Unknown Source)







Exception from UI:
FAILURE  :E- mail settings saved successfully. But error occurred while trying to check connection with mail server - Problem connecting to mailbox



.




Symtoms :

Telnet on Port 993 returns the message "BYE Connection is closed. 14 Connection to host lost"








Cause :

Mail server configured in Admin -> Mail server
Settings -> Incoming does not have a valid SSL certificate assigned to IMAP or POP services even though the mail server has got the SSL certificate installed, therefore when trying to communicate via IMAPS on port 993 it's unable to recognize the SSL certificate from it.










Solution :


1. Go to Exchange Console -> Server Configuration -> Click on the Mail server name -> Select a certificate from the list -> Assign a certificate to IMAP, POP and SMTP services. 

2. Restart the respective services from services.msc

3. Alternatively, the same steps can be performed via PowerShell window, 

To get list of Certificates installed
in
the server,


[PS] C:\Windows\system32>Get-ExchangeCertificate

Thumbprint Services Subject
---------- -------- -------
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy .P.... CN=exch2010fe1
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx I..W.. CN=webmail.example.com, OU=Domain Control Validated, O=webmail.ex...


To assign a certificate
for
IMAP service. Copy the valid certificate's thumbprint from the above output and apply it in the below command.


[PS] C:\Windows\system32>Enable-ExchangeCertificate -ThumbPrint xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -Services IMAP -DoNotRequireSSL