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:
- Create new ImapClient with a NullProtocolLogger() as parameter.
- Call .Connect() of this client, wih (username, password, false) parameters.
- Call .Authenticate() of this client with new NetworkCredentials.
- Getting the inbox folder and receive the mail that I'm looking for.
- 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??