GetTotalMessageCount Exception

Jun 9, 2010 at 8:37 AM

 

I get "Input string not in correct format" by calling GetTotalMessageCount in Pop3Client class.

Do I miss something? Is there an code sample for setting up the pop3 client ?

 

Thanks in advance

Jun 9, 2010 at 8:42 AM

The Exception Stack Trace is the following:

at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt64(String value, NumberStyles options, NumberFormatInfo numfmt)
at System.Int64.Parse(String s)\r\n
Higuchi.Net.Pop3.Command.Stat.GetTotalMessageCount(String text)
at Higuchi.Net.Pop3.Command.Stat.Result..ctor(String text)
at Higuchi.Net.Pop3.Pop3Client.ExecuteStat()
at Higuchi.Net.Pop3.Pop3Client.GetTotalMessageCount()

Coordinator
Jun 10, 2010 at 5:32 PM

OK.Please show me entire your code.
I'll check it.

Jun 10, 2010 at 9:03 PM

My initial code was:

 

 

 

Higuchi.Net.Pop3.Pop3Client popClient = new Higuchi.Net.Pop3.Pop3Client();
popClient.AuthenticateMode = Higuchi.Net.Pop3.Pop3AuthenticateMode.Pop;

 

popClient.Password ="xxxxxxx";
popClient.Port = 995;
popClient.ServerName ="pop.gmail.com";
popClient.Ssl = true;
popClient.UserName = "xxxxx@domain.com";
bool authpop = popClient.Authenticate();

 

if (authpop)

 

{

 

 popClient.Open();
 long mc = popClient.GetTotalMessageCount();

 

 if (mc > 0)
 {

long i = 1;
  while (i <= mc)
  {
   Higuchi.Net.Pop3.Pop3Message msg = popClient.GetMessage(i);
   
   <.........>

 

   i++;
  }
 }
 popClient.Close();
}

 

 

 

 

 

As soon as I removed the line: 

popClient.Open() it worked....

Any ideas??

 

Thanks in advance

 

Coordinator
Jun 10, 2010 at 10:57 PM

Open method will open connection to pop3 server.
Inside Authenticate method,the connection already opened.
So,you need not call open method after calling Authenticate method.

Jul 19, 2012 at 4:55 PM
Edited Jul 19, 2012 at 4:56 PM

I get the same error. I did not used any Open or Close method. Can you please advice?

Also this does not appear all the time. It's occurance is random