Drake
Drake

Reputation: 3891

C# OpenPOP index

I am using the OpenPOP library to get Gmail. The issue is that the emails are not in the order that they were received.

pop3 = new Pop3Client();
pop3.Connect("pop.gmail.com", 995, true);
pop3.Authenticate("[email protected]", "test", AuthenticationMethod.UsernameAndPassword);

emailAmount = pop3.GetMessageSizes().Count;

for (int i = 1; i < emailAmount; i++)
{
    tempMessage = pop3.GetMessage(i);

    tbStatus.Text = ASCIIEncoding.ASCII.GetString(tempMessage.RawMessage);
}

pop3.Disconnect();
pop3.Dispose();

The emails received are all scattered. Why is this and how can I resolve it?

Upvotes: 2

Views: 973

Answers (1)

Bevan
Bevan

Reputation: 44307

As far as I recall (and it's been a while since I read RFC-1939), the POP3 server has no obligation to list messages in any particular order at all.

So, if you care about processing the messages in the order received, it'll be up to you to sort them into that order before processing them.

Upvotes: 2

Related Questions