0

When I'm using MailKit against an Exchange server, I see following flow from the exchange server log, showing an excessive long time between starttls and capability (about 15s), and some times this same procedure takes about 20ms, which is a huge difference!

The flow looks like:

OpenSession 
capability  
starttls    
capability  
authenticate NTLM
capability
namespace   
list "" "INBOX"
list "" Inbox
select INBOX
uid FETCH 22274 (BODY.PEEK[])
logout  

In MailKit I'm creating a new ImapClient each time, like this:

  1. Create new ImapClient with a NullProtocolLogger() as parameter.
  2. Call .Connect() of this client, wih (username, password, false) parameters.
  3. Call .Authenticate() of this client with new NetworkCredentials.
  4. Getting the inbox folder and receive the mail that I'm looking for.
  5. Call .Disconnect(true) of this client.

I can't see why the Exchange server suddenly once in awhile should stumble on the same sequence between 'starttls' and 'capability'.

Any ideas? Is it a Exchange server issue, or is this a MailKit issue??

jstedfast
  • 35,744
  • 5
  • 97
  • 110
grmihel
  • 784
  • 3
  • 15
  • 40

1 Answers1

1

It's an Exchange server issue. Most likely the server is overloaded with requests from other clients or something.

jstedfast
  • 35,744
  • 5
  • 97
  • 110
  • Thats exactly what I was afraid. The problem is that the Exchange Throttleling policy has already been maximized. Are there any known work-arounds for this issue? And why does the starttls show, when the connect() has false as argument?? – grmihel Feb 04 '16 at 18:56
  • The Connect() method you are using has a bool argument to specify whether or not it should use an ssl-wrapped connection which says nothing about whether it should use STARTTLS or not. If you want a clear-text connection, use `Connect (host, port, SecureSocketOptions.None);` – jstedfast Feb 04 '16 at 18:59
  • So just to make sure, if I use Connect (host, port, SecureSocketOptions.None); this prevent the STARTTLS part? – grmihel Feb 05 '16 at 11:02