Solved

can't delete mails using Winsock.SendData "DELE x"

Posted on 2004-04-01
8
752 Views
Last Modified: 2013-12-25
hi experts,

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,

flor
0
Comment
Question by:papaflo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 10735684
The Winsock control is a generic control for sending and receiving data, and as such, it has no knowledge of what you are doing with it (sending files, getting mail, playing a game, etc.).  Any error codes would have to be sent to you via the DataArrival event and this would be a function of your mail server.

For someone to help you with this problem they would need to know what kind of mail server you are accessing.

Idle_Mind
0
 

Author Comment

by:papaflo
ID: 10735777
thanks for the input, Idle_Mind
would you be one of those someone who, if they know what kind of mail server i am accessing, they would be able to help me out?
i am using IMail by the way
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 10735833
I have lots of experience with the Winsock control through various FTP, File Transfer, and Chat applications but unfortunately have never used it to get mail from a server.

Sorry.

Idle_Mind
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:papaflo
ID: 10736829
that allright, Idle_Mind
if you know of anybody who's got answers, please ask them to help out
thanks anyhow
0
 
LVL 5

Expert Comment

by:crazycomputers
ID: 10737424
How are you logging out?  Using WinSock.Close will not work.  According to the SMTP protocol RFC, terminating the connection does not purge any messages marked deleted.  You need to do

WinSock.SendData "QUIT" & vbCrLf

to delete the messages.

(I'm not sure which method you're using, but I've had this problem too, and this is how I fixed it.)
0
 
LVL 2

Assisted Solution

by:jasonholland
jasonholland earned 60 total points
ID: 10737430
Well, you said you are using Imail so I went to IPSwitch's website and looked up IMail server error codes

http://support.ipswitch.com/kb/IM-20000419-DM01.htm

Take a look at the error codes, and put some traps in your DataArrival event for these error codes being returned as data.

Jason Holland
0
 

Author Comment

by:papaflo
ID: 10742454
thanks for the input, guys

crazycomputers:
i do use
WinSock.SendData "QUIT" & vbCrLf
and i am able to delete messages in the normal case as i've mentioned above
i only run into problems when i had those "blank" messages [please see my initial post above]

jasonholland:
i do have error handlers on my code, but as mentioned, when the "blank"messages occurred, my program did not delete messages but NO ERROR WAS RAISED [please see my initial post above]
i also have code on the  Winsock_Error event by the way, and that portion of the program was not reach as well

any of you guys know anything about a unique email ID? [please see my initial post above]
0
 
LVL 5

Accepted Solution

by:
crazycomputers earned 65 total points
ID: 10743451
I do not believe that SMTP provides a unique mail ID beyond the message numbers.  It looks like this is a server problem.  Try contacting the server administrator and see if he can't explain what's going on.
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

687 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question