Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CDO and Error Handling

Status
Not open for further replies.

PaulHerschell

Programmer
Oct 9, 2001
59
NL
I think from my tests CDO will work regardless of whether Outlook is running or not and regardless of whether there is a live internet connection. It simply sits in a hidden outbox much the same way with automation it sits in a visible outbox until ready to go. Is this assumption correct? What error handling should I be considering with CDO? Any help on this is really appreciated. Thanks

Paul Herschell
 
Mike,

I have followed your link but to be honest it gets a bit heavy and I am finding it difficult to extract the answers that I am looking for. The document also talks about CDO being used for Exchange whereas the environment that I am using here and many customers will be using does not use Exchange and simply connects straight through to the ISP mail account through Outlook. The link also makes no mention of XP or Outlook 2003 and as I would hope most customers will be using one or the other then I need to ensure that those bases are covered also. I appreciate that there are alternatives to CDO and I see this as a stop gap until I can build more mail tracking functionality into my app to monitor what has been sent out.

Can I ask some very specific questions again and maybe yourself or someone else could address them point by point.

Q1. How does CDO know what mechanism to send email out on, i.e. which ISP, what is the username, password etc? I can only assume that it gets this info from Outlook on a standalone machine?

Q2. When it sends the email, does it put it in Outlook somewhere before it is sent even though you see nothing in the Outbox? (My concern is obviously dialup users who may not have a permanent internet connection, will their mail fail if they are offline or will it simply stackup somewhere?)

Q3. If mail stacks up because you are offline, will a reboot cause any loss of mail or will it simply go through next time you connect to the internet after the reboot

Q4. On the error handling I suppose I am looking for ideas on trapping the most obvious errors eg how to detect CDO is not installed, can CDO report back that a mail item was not sent etc.

Bypassing the Outlook security issue is great but without seeing your mail in the Outbox and Sent Items folders you are working kind of blind. My own tests on a standalone PC with Outlook XP and Windows XP infer I should not be worried as mail just stacks up when I disconnect my broadband connection and then reconnect it again but I want to check this out thoroughly.

Any further help really appreciated. Thanks

Paul Herschell
 
Q1. How does CDO know what mechanism to send email out on, i.e. which ISP, what is the username, password etc? I can only assume that it gets this info from Outlook on a standalone machine?

No, I would think it picks up from the registry, since Outlook does not need to by installed. For example if I use this on my system:
oSession = CreateObject("MAPI.Session")
oSession.logon()

It brings up the profile window to have me select a profile to use, and permits me to create a new one if that is required.

Q2. When it sends the email, does it put it in Outlook somewhere before it is sent even though you see nothing in the Outbox? (My concern is obviously dialup users who may not have a permanent internet connection, will their mail fail if they are offline or will it simply stackup somewhere?)

Since CDO does not use Outlook to send e-mail, it does not store the message there either. I have a feeling that you want to find a way to bypass the security, but still retain the rest of what Outlook provides you.

Q3. If mail stacks up because you are offline, will a reboot cause any loss of mail or will it simply go through next time you connect to the internet after the reboot

I would guess they would be lost.

Q4. On the error handling I suppose I am looking for ideas on trapping the most obvious errors eg how to detect CDO is not installed, can CDO report back that a mail item was not sent etc.

Here is a list or error codes for CDO and MAPI that you can use to detect all errors.

P.S. I would suggest since you have 3 posts relating to CDO that you keep your questions to one post, since some of your questions are being answered in other posts (like how to detect if CDO is installed)

P.P.S. CDO is mostly meant to be used with Exchange, but it can be use separatly, but you woudl need to build an e-mailing application around it, where as all you want to do is bypass the security patch. CDO might not be the solution you are looking for. Outlook redemption might be the better solution for you (



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike,

Thanks for that. A picture is slowly starting to emerge although I am not sure if I am quite where I want to be yet.

Perhaps I should clarify what I am doing. I wrote an app that sends batches of emails to selections in my VFP tables using Automation and Outlook 2000 or above. It worked a treat until the Microsoft Security patch came in then it became a pain to send large batches and I recommended to customers to install Outlook 2000 Sr1 or below on at least 1 workstation on their networks to avoid the problem with large maillists. Now I have come to review the problem several months later and find that there is not one but several solutions and it is not really clear which is best for me.

I am happy working with Outlook for now and I like the confidence of seeing something go into Outbox and then go into Sent items, it gives a confidence that something has gone. I don't see much point in reinventing the wheel in terms of writing code to ensure that something goes, however, I will be extending my app in the medium term to keep logs of what email has been sent to which particular contacts by creating corresponence table entries in my app each time an email is sent be it a single email or large batch.

I latched onto CDO as it seemed to instantly override the security patch for 5 minutes of code but has the flaw that I am not sure whether everything went or not.

I have browsed the redemption details and whilst it looks like it will do the job, it does a lot more than I need and on I am a little reluctant to pay $199 to simply do the same as I was doing before Microsoft introduced the security patch although I am keeping it in reserve should I not come across an easier / cheaper solution.

I am also looking at the solution from Gerrit which is freeware and sounds like it should work, however, it sounds more like what I want in the medium terms where I am not dependant on Outlook but have to finish the correspondence tracking part of my app to replace Outlooks sent items folder and add extra functionality. Something I want to do, but just a couple of months further down the line!

As ever I want to keep everything simple, I am not one to use a sledgehammer to crack a nut and the ideal world at this stage would have been if Microsoft had allowed authorised applications past the security system in Automation, they don't seem to as far as I can see, however the 'allow for 10 minutes' option I saw today when running your Exchange server MAPI code seemed like a breath of fresh air.

Apologies about the 3 posts on CDO, they were all different questions initial which I expected to be very simple answers as as ever in this kind of environment the shorter question usually gets the quicker answer! Little did I know it was going to get so involved. I will try not to let things overlap.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top