Hello.
I faced with some issues with Imap SSL connections.
The code, listed below is working fine:
_imap.Connect(host, Imap.DefaultPort);
var parameters = new TlsParameters();
parameters.CommonName = host;
parameters.CertificateVerifier = new CustomCertificateVerifier();
_imap.Secure(parameters);
_imap.Login(userName, password);
internal class CustomCertificateVerifier : ICertificateVerifier
{
public TlsCertificateAcceptance Verify(TlsSocket socket, string commonName, CertificateChain certificateChain)
{
return TlsCertificateAcceptance.Accept;
}
}
But it is not exactly what i want.
The code below produce timeout exception:
var parameters = new TlsParameters();
parameters.CommonName = host;
parameters.CertificateVerifier = new CustomCertificateVerifier();
_imap.Connect(host, port, parameters, ImapSecurity.Explicit);
_imap.Login(userName, password);
Error text:
2011-06-07 17:59:31,969 Oz NT AUTHORITYSYSTEM [7] ERROR Services.Windows.MailServer.MailServerFacade [(null)] - RefreshInbox, check new emails exception.
Rebex.Net.ImapException: Timeout exceeded.
at Rebex.Net.Imap.QztfFZ()
at Rebex.Net.Imap.Connect(String serverName, Int32 serverPort, TlsParameters parameters, ImapSecurity security)
Our mail server logs:
Session 26457; child 8
Tue 2011-06-07 17:57:29: Accepting IMAP connection from [81.222.243.70:10162] to [81.222.243.69:993]
Tue 2011-06-07 17:58:30: * SSL error 0 The operation completed successfully.
Tue 2011-06-07 17:58:30: IMAP session terminated, (0 bytes)
So, coul you point out, what things I'm doing wrong?
Thank you.