Just before user will disconnect from your server, you
need to update his mailbox changes made in the session so
next time his mailbox is synced with his changes. For
instance, when user reads and downloads messages from the
server he will usually mark them to be deleted so he
doesn't need to download them again (and again and
again...). For this purpose, UpdateMailbox event is fired
so you can make these changes.
Most changes are related directly to Deleted
property. You should make a loop and check each user's
message and test if Deleted property is set to
True. If so, you should delete it from local
storage.
This is rather easy task if you keep each mail in
separate file. But, if you have one mailbox per user, and
keep all his messages in one file (UNIX systems do this)
then you have more work to do. Maybe you should try to keep
external file with 'message positions' inside of
it, so you know where each message starts and where each
message ends. Using such file, it will be easier for you to
setup StartPosition
and EndPosition
properties needed during Connected
event, and will be easier to remove messages from mailbox
file.
If you don't have such file, you can still use already
setup (you did that!) StartPosition and EndPosition
properties, because wodPop3Server didn't change those
values. If you calculated them for Connected event, they
are still valid.
So, to test if message is deleted or not, simple loop
like this will help:
For i =
0 To User.Messages.Count - 1
If User.Messages(i).Deleted = True Then
Kill
MessagePath & "\message." & i
End If
Next
i