Discuss this help topic in SecureBlackbox Forum

POP3: Get the list of messages in the mailbox

Use TElPOP3Client.GetMessageList() method to get the list of messages available in the mailbox. For each message, its index and size in bytes are returned.

Examples:

C#:


TSBPOP3MessageSize[] list = pop3.GetMessageList();

Console.WriteLine("List ({0} messages)", list.Length);

for (int i = 0; i < list.Length; i++)
    Console.WriteLine("{0} = {1} bytes", list[i].Index, list[i].Size);

Message index can be changed between sessions, if one of the messages is deleted when the session is closed. Most of servers support unique IDs for messages (see ExtUIDLSupported property). These IDs are unique for this server, i.e. the same ID will not be assigned to two or more different messages. Even when a message is deleted from the server, its ID will not be used for any other message in the future. Use TElPOP3Client.GetMessageIDList() method to get the list of message indices and corresponding IDs and thus translate the list of message indices to message IDs.

Examples:

C#:


TSBPOP3MessageID[] ids = pop3.GetMessageIDList();

Console.WriteLine("List ({0} messages)", ids.Length);

for (int i = 0; i < ids.Length; i++)
    Console.WriteLine("{0} = {1}", ids[i].Index, ids[i].ID);

The mentioned methods return after the entire lists are downloaded. If it's needed to get the lists message-by-message, there are ReceiveMessageList() and ReceiveMessageIDList() methods available. These methods fire OnMessageSize and OnMessageID events respectively for each message available in the mailbox.

How To articles about POP3 client

Discuss this help topic in SecureBlackbox Forum