Discuss this help topic in SecureBlackbox Forum
POP3: Receive only new messages arrived after the last session
To have this task done, the following steps should be performed:
Examples:
C#:
SBStringList.TElStringList knownIDs = new SBStringList.TElStringList();
// load known IDs
knownIDs.LoadFromStream(...);
// sort the list to speed up searching
knownIDs.Sorted = true;
TSBPOP3MessageID[] ids = pop3.GetMessageIDList();
foreach (TSBPOP3MessageID id in ids)
{
// check if the id is not known
if (knownIDs.IndexOf(id.ID) < 0)
{
// receive this new message
pop3.ReceiveMessage(id.Index);
// remember its ID to not download the message again
knownIDs.Add(id.ID);
}
}
// save the list of known messages
knownIDs.SaveToStream(...);
Also, it is possible to call ReceiveMessageIDList() on the first step and to check message IDs in OnMessageID event handler one-by-one.