Are POP3MessageInfo sorted from server ?

0 votes
asked Sep 22, 2016 by pilouk (520 points)
edited Sep 22, 2016 by pilouk

We would like to handle already downloaded email without looping and fetching all of them. Are the POP3MessageInfo already sorted by date ?
If yes who decide the order of the pop3Messageinfo ?

We have some pop3 mailbox which contain 8800 messages on server and are never deleted..
If the pop3messageinfo have no sorted logic then we have no way to prevent looping all the message each time we refresh. If the pop3messageinfo were sorted by date then we would be able to fetch the first pop3message headers to check the date then exit the loop

Applies to: Rebex Secure Mail

1 Answer

+1 vote
answered Sep 22, 2016 by Lukas Matyska (46,810 points)
selected Sep 22, 2016 by pilouk
 
Best answer

The POP3 protocol is very simple and doesn't define any sorting. This is what RFC 1939 says:

After the POP3 server has opened the maildrop, it assigns a message-
number to each message, and notes the size of each message in octets.
The first message in the maildrop is assigned a message-number of
"1", the second is assigned "2", and so on, so that the nth message
in a maildrop is assigned a message-number of "n". In POP3 commands
and responses, all message-numbers and message sizes are expressed in
base-10 (i.e., decimal).

Very often the POP3 server assign numbers in ascending order as the message comes. So the oldest message has number 1. However, it is not guaranteed (you should check server's documentation if it is guaranteed).

...