Re: VB6 CDO Email Lockup Bug
Aside from your use of magic numbers (all of those Field names have predefined constants, as do many of the setting values) there isn't much to comment on.
The cdoSMTPConnectionTimeout field has been set to 60 seonds. So if it exceeds 60 seconds to connect you ought to be seeing an exception raised. Once connected however a slow connection can probably take... as long as it takes to get the job done.
What kind of answer were you hoping for? I don't see any programming problem here, just an infrastructure problem we can't do anything about.
About all I can think of to suggest is that you have a special case here that might be handled differently. Your existing program could be changed to just queue emails for sending, and a second program could be written to pick up these queued emails and send them at the pace it can manage. For something as slow as every 30 minutes you might just use a some folder as a queue and drop each outbound message into it as a file named based on the timestamp.
The worker program could be a Service or it might just be a Startup folder program or something. It could just look in the pickup folder (queue) for the next message and try to send it via CDO or whatever approach you want. I suppose you can write that as two programs: a monitor program to start and make sure the actual worker doesn't lock up, and a worker to pick up and send stuff.
If the monitor detects the worker has locked up it can kill it, then sleep for a while before starting the worker to try again.
Of course this is all basically what the IIS SMTP Service already does for you. Perhaps you might consider using that as your local mail relay service. CDO can send through that with just a few changes to the configuration parameters.
Re: VB6 CDO Email Lockup Bug
Thks you for your reply.
We have a network of these systems installed creating simple text messages to be emailed every 30 mins. All email programs use the same basic set of email settings, all sending to the same server, only in the content of the data messages is there any differences. So don't believe this is the problem.
Regarding your paragraph "About all I can think of to suggest...". We have already designed our software along the basic lines you have suggested.
The main problem appears to be that the timeout function (whether 60 secs or some other period) does not appear to work in all circumstances! If possible I would prefer to be able to fix this problem from within the VB program itself. ie. If the email CDO program does not return then a new procedure would be run to kill it, and then continue on.
Is there some way to do this from within a VB program?
Thks