can't delete mails using Winsock.SendData "DELE x"
Posted on 2004-04-01
i am using the Winsock control to grab mails from a mailbox.
i do the usual checking of the DataArrival event of the control, call the GetData method to retrieve messages from the mail server and i always get my email as a stream of encoded asciis, no problem.
so i get my emails, store them for future processing, and delete them from mailbox, repeat the procedure, and it works perfect. of course, i use the SendData method to do the deletion [Winsock.SendData "DELE x"].
everything's been fine until recently.
i had a scenario where for some reason i got a number "blank" mails on my mail server. by blank i mean, there was no sender, subject, body, etc indicated on the emails. i don't know how those "blank" mails got to the server in the first place. this might have been caused by the virus scanner but i am not too sure.
anyway, my program read the other legitimate mails from the server together with those blank ones and processed them, but was not able to delete any email successfully. it ended up reading the same set emails over and over again and needless to say, i had disastrous results.
questions: when using the winsock control, is there any email ID that i can use to tell that a particular email has already been looked at [and was just retrieved again because it was not deleted]. also, does Winsock.SendData "DELE x" return any error when it is not able to delete mails? i am using VB and i have an "On Error GoTo Label" statement on my code. it was not able to do the deletion but it just kept on going and retrieving the same set of emails and didn't return an error for 12 hours until i stopped it.
thanks in advance,