Please help me. ImapException: Previous operation has not finished yet.

Subscribe me to this topic
  • Posted on Mon, 20 Feb 2012

    Dear ComponentPro

    Following error is traced by using the IMAP Client in threads.

    Unhandled Exception: ComponentPro.Net.Mail.ImapException: Previous operation has not finished yet.

    at ComponentPro.Net.Mail.ImapClient.AsyncBeginLck() in ComponentPro.UltimateMail\UltimateMail\Net.Imap\ImapClient.cs:line 4175

    at ComponentPro.Net.Mail.ImapClient.SendCommand(String command, Object[] parameters) in EmlMigrationForExchange\ComponentPro.UltimateMail\UltimateMail\Net.Imap\ImapClient.cs:line 2387


    In my code snip, it try to create ImapClient object and then connect to the IMAP server in number of thread.

    private static void TestInThread(List<string> Users)

    {

    foreach(string user in Users)

    System.Threading.ThreadPool.QueueUserWorkItem(ConnectToServer, user);

    }
    private
    static void ConnectToServer(object asyncState)

    {

    try

    {

    string[] user = Convert.ToString(asyncState).Split(new char[] { ',' });

    ComponentPro.Net.Mail.ImapClient imapClient = new ComponentPro.Net.Mail.ImapClient();

    imapClient.Connect("172.16.2.12", 143);

    imapClient.Authenticate(user[0], user[1]);

    }

    catch (Exception ex) { Console.WriteLine(ex); }

    }


    Do you have any ideas for resolving?

  • Posted on Mon, 20 Feb 2012

    I’m sorry.

    This is in my fault.

    Thank you.