This project is read-only.

Response Timeout when retrieving emails

Jan 12, 2012 at 5:33 PM
Edited Jan 12, 2012 at 5:38 PM

I built a simple class containing your receive mail example. It seems to authenticate, but I keep getting a Response timeout on the following line:


Pop3Message mg = cl.GetMessage(MailIndex);

I tried to increase the cl.ReceiveTimeout = 120000 (which I'm assuming is milliseconds), but this didn't seem to make a difference. Any idea why this would be happening? I'm testing this locally using Visual Studio 2010. 

Also, is there any in-depth documentation regarding all of the various classes, constructors, properties and methods contained within the various libraries? I just started using this, but I'm afraid that once I start building my application that I will have questions about what certain things do or don't do.


Jan 12, 2012 at 11:26 PM

I'll investigate about your reproduction code.
Please show me entire reproduction code to do it.

Document does not exist.
I couldn't have a time to create document.Sorry...
But feel free to ask me on this discussion forum.
I'll answer to all of your question.
I think that many question make this forum more efficient than document.

Jan 12, 2012 at 11:32 PM
    public static string retrieveEmails()
      Pop3Client cl = new Pop3Client();
      String title = "";
      cl.ServerName = "*********";
      cl.UserName = "********";
      cl.Password = "**********";
      cl.Ssl = false;
      cl.ReceiveTimeout = 120000;
      if (cl.Authenticate() == true)
         Int32 MailIndex = 1;
         Pop3Message mg = cl.GetMessage(MailIndex);
         String mailTo = mg.To;
         String mailCc = mg.Cc;
         title = mg.Subject;
         String bodyText = mg.BodyText;
      return title;
Jan 12, 2012 at 11:39 PM

Your code has no problem.
Is is reproduct 100% in your environment?

Jan 12, 2012 at 11:43 PM

I'm simply calling this function from a page's code-behind. This function is contained within a class project and is complied into a DLL.

When I step through the code using Visual Studio, it just spins on Pop3Message mg = cl.GetMessage(MailIndex) until the timeout is reached.

Question: What is "MailIndex"?

Jan 13, 2012 at 12:18 AM
Edited Jan 13, 2012 at 12:19 AM

I figured out the problem. The email box was empty. When there was email in the box, it worked perfectly!

How do I check this prior to attempting to collect email?

Is there a way to count the emails within the box?

Is there a way to collect all of the emails and then step through each one?

Thanks for the help!

Jan 13, 2012 at 12:54 AM

You can call GetTotalMessageCount method of Pop3Client class.

Pop3Message mg = null;
Int32 mailCount = cl.GetTotalMessageCount();
for (int i = 1; i<mailCount + 1; i++)
     mg = cl.GetMessage(i);
     //Do something...