Discuss this help topic in SecureBlackbox Forum

POP3: Delete and restore messages on the server

Messages on POP3 servers are numbered from 1 to message count. Each message has its index which remains the same until the end of the session.

Call DeleteMessage(index) method to mark the message with the specified index on the server for deletion. The message will remain on the server but it will not be present in all future message lists and ID lists. Also, please note that messages with greater indexes are not going to be renumbered. I.e., if there are 3 messages on the server (indexed 1, 2 and 3) and the message with index 2 is deleted, GetMessageList() and GetMessageIDList() will return only 2 messages - with index 1 and 3. If you attempt to do something with the message marked for deletion, the server will report an error and an exception will be thrown.

All the messages marked for deletion during current session are actually deleted from the server only after a graceful logout. I.e. when Close() method is called without a parameter or with a Silent parameter set to false, it gracefully log outs from the server and the deleted messages are actually removed from the mailbox. If the method is called as Close(true), it terminates connection immediately, without sending QUIT command, and as such, the marked messages will remain in the mailbox and will be returned in listing results in future sessions.

If it's needed to "undelete" messages marked for deletion and remain them in the mailbox after graceful logout, call Reset() method. After this, the messages will be available for download and will be present in list results.

How To articles about POP3 client

Discuss this help topic in SecureBlackbox Forum