| Author |  | 
      
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          Ii still couldn't get how it connects in the last case. Which settings does it use? Or is it completely random?
           | Posted: 01 August 2011 at 11:44am | IP Logged |   |  
           | 
 |  
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | vdumas Newbie
 
  
  
 Joined: 28 July 2011
 Location: Canada
 Online Status: Offline
 Posts: 12
 | 
          It connects after many retries sometimes and other times faster.
           | Posted: 01 August 2011 at 11:54am | IP Logged |   |  
           | 
 |  Here is the code:
 
 
 public Imap Connect(string server, int port)
 {
 Global.Pipelining  = true;
 MailBee.ImapMail.Imap.LicenseKey = _licenseKey;
 MailBee.ImapMail.Imap imap = null;
 DateTime start = DateTime.Now;
 Global.AutodetectPortAndSslMode = false;
 
 if (imap == null)
 {
 imap = new Imap();
 imap.ThrowExceptions = false;
 // configure encryption
 imap.SslProtocol = MailBee.Security.SecurityProtocol.Tls1;
 imap.SslMode = MailBee.Security.SslStartupMode.OnConnect;
 imap.Log.Enabled = true;
 imap.Log.Filename = "C:\\Temp\\imap_log.txt";
 imap.Log.Clear();
 }
 
 ClearLog("Trying " + server + ":" + port + "...");
 int numberOfRetry = 0;
 
 while (!imap.Connect(server, port) && numberOfRetry < 30 )
 {
 // sleep and retry
 System.Threading.Thread.Sleep(1000);
 this.Log("Re-Trying " + server + ":" + port + "...");
 imap.ResetState();                              &n bsp;
 this.Update();
 numberOfRetry++;
 }
 
 if (numberOfRetry >= 30)
 {
 this.Log( DateTime.Now + "- Failed for 30 seconds" );
 return null;
 }
 
 // connect did not throw exception, then sto.Tls1rying
 this.Log( DateTime.Now + "- Success!" );
 return imap;
 }
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | vdumas Newbie
 
  
  
 Joined: 28 July 2011
 Location: Canada
 Online Status: Offline
 Posts: 12
 | 
          It works well when the session ID of the packet is not set (length 0).
           | Posted: 03 August 2011 at 7:58am | IP Logged |   |  
           | 
 |  | 
       
        | Back to Top |     | 
       
       
        |  | 
        | vdumas Newbie
 
  
  
 Joined: 28 July 2011
 Location: Canada
 Online Status: Offline
 Posts: 12
 | 
          I contact the support because this issue has been causing important problems since march and we need to find a solution to turn SSL packets off.
           | Posted: 03 August 2011 at 8:33am | IP Logged |   |  
           | 
 |  
 As described here
 http://www.afterlogic.com/forum/forum_posts.asp?TID=3410
 
 We set these:
 Global.AutodetectPortAndSslMode = false;
 imap = new Imap();
 imap.SslMode = MailBee.Security.SslStartupMode.OnConnect;
 imap.SslProtocol = MailBee.Security.SecurityProtocol.Tls1;
 imap.Connect(imapConfig.Host, imapConfig.Port);
 
 This sends randomly packets that are containing a session ID (SSL). The exchange server does not like those and sends a reset on the connection.
 It only accepts TLS packets.
 
 Setting the MailBee.Security.SecurityProtocol.Tls1 should be disabling the SSL session ids, at least after the first attempt when a reset was received.
 
 
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          Try the version for .net 1.1 framework from http://www.afterlogic.com/updates/mailbee_net_1.zip to see if it makes any difference.
           | Posted: 03 August 2011 at 8:52am | IP Logged |   |  
           | 
 |  
 .net 2.0+ optimized version uses the .net's standard SslStream class which we have no direct control of while .net 1.1 version can set allowed SSL protocols directly on WinAPI level.
 
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | vdumas Newbie
 
  
  
 Joined: 28 July 2011
 Location: Canada
 Online Status: Offline
 Posts: 12
 | 
          Same behavior, maybe we should use your active x?
           | Posted: 03 August 2011 at 10:13am | IP Logged |   |  
           | 
 |  | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          Good idea, it's worth trying.
           | Posted: 03 August 2011 at 10:54am | IP Logged |   |  
           | 
 |  
 Also, does it behave the same way on different computers? Maybe, the issue is OS dependent or something like that? Is it possible to get external IP for the server to check from our place, for instance?
 
 regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  |