From Overbyte
Jump to: navigation, search

Main page -> ICS components reference -> TPop3Cli -> MsgNum


MsgNum : Integer;

Set this to fetch specific message.


The message number always starts with number 1 for the first message and increments by one. To delete, you always have to specify the message number, message id will not work. This number will not change during a session. The DELE command does not actually delete the message, it just marks the message to be deleted. The server deletes all messages marked for deletion when the session is closed (QUIT command). If you need to clearly identify a message during *multiple* POP3 sessions (i.e. to remember if the message has been retrieved already), the message number is no good, as it always starts with the first message in the mailbox as number one. For such purposes you need to use the message ID.

MsgNum is dynamic, it's the order in which the emails are retrieved from the POP3 server and will change as new emails arrived and old ones are deleted. It is only valid while the POP3 mailbox is open, during which time no new email can arrive. Most POP3 servers offer a snapshot of the mailbox when it is opened, and ignore any new email that arrives subsequently, so STAT, LIST, UIDL and RETR all use the same message numbers.

UID should be unique for a mailbox, and never repeated. So that is safe for deleting mail, just do the Pop3.UIDL command to get the list that matches MSGNUM against UID.

How To / Examples

Nothing yet :-)