Click here to Skip to main content
15,891,375 members
Please Sign up or sign in to vote.
3.00/5 (3 votes)
See more:
I'm trying to read emails from an exchange server and make an raport with them, but i encounter a problem. I think my application dosen't retrive the mail correctly, because when I search the specific Inbox throw the webapp it finds 1000 results but when i search the same text it finds only 333. This is my code:

C#
using Higuchi.Net.Pop3; 
Pop3Client pop3Client = new Pop3Client("username", "pass", "srv");
pop3Client.Authenticate();
long totalCount = pop3Client.GetTotalMessageCount();
for (int emailCounter = 1; emailCounter < totalCount + 1; emailCounter++)
{
	Pop3Message mg = pop3Client.GetMessage(emailCounter);
	sr.WriteLine(mg.Subject);
}
pop3Client.ExecuteQuit();
Console.WriteLine("Finished!");
sr.Close();
Console.ReadLine();


I tryed diffrent class for reading pop3 email still same result. The exchange server is 2010.
Posted
Comments
[no name] 19-Apr-12 15:29pm    
There is nothing here that that indicates that you are limiting your messages to the "Inbox". GetTotalMessageCount() could be counting the Inbox, Outbox, spam folder, trash, and every other message folder for all we know.
SASS_Shooter 23-Apr-12 12:02pm    
I assume from this code that you are not using the .NET framework to access the Exchange server? Why not use what the framework provides. This exposes such enumerators such as WellKnownFolderName.Inbox

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900