title: How to read latest email from Yahoo mail using pop3 c#
body: <p>I want to read email from my yahoo mail account. I am using "OpenPop.Pop3" to read email from my yahoo mail account, I am using below code :-</p>
  
  <pre><code>using OpenPop.Pop3;    
  
  public DataTable ReadEmailsFromId()
  {
      DataTable table = new DataTable();
      try
      {
          using (Pop3Client client = new Pop3Client())
          {
              client.Connect("pop.mail.yahoo.com", 995, true); //For SSL                
              client.Authenticate("Username", "Password", AuthenticationMethod.UsernameAndPassword);
  
              int messageCount = client.GetMessageCount();
              for (int i = messageCount; i &gt; 0; i--)
              {
                  table.Rows.Add(client.GetMessage(i).Headers.Subject, client.GetMessage(i).Headers.DateSent);
                  string msdId = client.GetMessage(i).Headers.MessageId;
                  OpenPop.Mime.Message msg = client.GetMessage(i);
                  OpenPop.Mime.MessagePart plainTextPart = msg.FindFirstPlainTextVersion();
                  string message = plainTextPart.GetBodyAsText();                           
              }
          }
      }
  return table;
  }
  </code></pre>
  
  <p>Same code is able to access other mails emails like gmail,outlook but while working with yahoo mail emails i am able to get Subject, Date but when came to message part that is:</p>
  
  <pre><code>OpenPop.Mime.Message msg = client.GetMessage(i);
  OpenPop.Mime.MessagePart plainTextPart = msg.FindFirstPlainTextVersion();
  </code></pre>
  
  <p>Its give error "The stream used to retrieve responses from was closed".</p>
  
  <p>Here is the "StackTrace":</p>
  
  <pre><code>at OpenPop.Pop3.Pop3Client.IsOkResponse(String response)
  at OpenPop.Pop3.Pop3Client.SendCommand(String command)
  at OpenPop.Pop3.Pop3Client.Disconnect()
  at OpenPop.Pop3.Pop3Client.Dispose(Boolean disposing)
  at OpenPop.Pop3.Disposable.Dispose()
  </code></pre>
  
  <p>Please let me know if i missing something or doing something wrong. 
  Also I have make yahoo mail emails to be accessed anywhere using POP.</p>