title: Using Mail.dll with Microsoft Exchange Imap version 4
body: <p>I am using <a href="http://www.limilabs.com/mail" rel="nofollow">mail.dll</a> for reading emails. Earlier I was reading the emails from a gmail account and every thing was working alright. Now I need to move the application to another server and read mail from microsoft exchange.Below is the code that I am using</p>
  
  <pre><code>using (Imap imap = new Imap())
  {
     imap.Connect("server-name", port number);
     imap.Login("username", "password");
     imap.SelectInbox();
     List&lt;long&gt; uids = imap.Search(Flag.Seen);
  
     if (uids.Count &gt; 0)
     {
         string eml = imap.GetMessageByUID(uids[0]);
         IMail email = new MailBuilder().CreateFromEml(eml);
         imap.GetMessageByUID(uids[0]);
         lbResponse.Text = email.Subject;
     }
      else
      {
         lbResponse.Text = "No mails found";
       }
    imap.Close();
  }
  </code></pre>
  
  <p>I have verified the port and server by using telnet and it is correct. But I get the "Unable to read data from the transport connection. A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond  " error. Please help.</p>