Description of CDONTS and how to troubleshoot CDONTS problems in Windows 2000 and in Windows NT 4.0 (324649)



The information in this article applies to:

  • Collaboration Data Objects (CDO) for NTS 1.2, when used with:
    • the operating system: Microsoft Windows 2000
    • the operating system: Microsoft Windows NT 4.0

This article was previously published under Q324649

INTRODUCTION

This article describes Collaboration Data Objects for Microsoft Windows NT Server (CDONTS). This article also provides troubleshooting techniques that you can use for errors that may occur when you create an object or when you send a message. To troubleshoot problems that may occur when you use the CDONTS objects, you have to understand what occurs when the code executes. Typically, problems are not related to the code itself. Problems are generally caused by the Simple Mail Transfer Protocol (SMTP) service setup.

back to the top

Definition of CDONTS

CDONTS is a COM component that exposes the following object interfaces:
  • The NewMail object
  • The Session object
The NewMail object is the object that is most frequently used.

CDONTS is primarily used by Web developers as a thin client for mailing Web forms. The DLL for CDONTS, also known as Cdonts.dll, is installed with Microsoft Windows NT Option Pack 4. The SMTP service must also be installed. Windows NT Option Pack 4 installs with backward compatibility for Microsoft Windows 2000. However, we recommend CDO for Windows 2000 (CDOSYS) for the Windows 2000 operating system.

CDONTS works directly with the SMTP service on the Internet Information Services (IIS) computer.

back to the top

How CDONTS works

To demonstrate how CDONTS works, use the following .asp sample code:
Dim objMail
Set objMail = CreateObject("CDONTS.NewMail")
ObjMail.Send "yourmail@somewhere.com", "someone@somewhere.com", "Subject", "This is the body."
Set objMail = Nothing
The following is a sequential description of what occurs in this sample code:
  1. The objMail variable object is created.
  2. The CDONTS.NewMail object is created, and then the CDONTS.NewMail object is assigned to the objMail variable object.
  3. The Send method of the NewMail object is executed and then passed to the From e-mail address, to the To e-mail address, to the Subject, and to the Body.
  4. The objMail variable object is destroyed by setting the object equal to Nothing.
Note When you troubleshoot a CDONTS problem, make sure that the previous sample code works from an .asp page or from a .vbs file. If the code does not work, the problem is not a code problem. The problem is probably an SMTP service setup problem.

back to the top

Creating a NewMail object

When you create a NewMail object, the process searches the registry and then finds the location of the Cdonts.dll file. The location of the Cdonts.dll file is retrieved from the InProcServer32 key. The NewMail object is created and then put in memory.

back to the top

Calling the Send method

When you call the Send method, the NewMail object accesses the metabase to determine where to put the e-mail (.eml) file. The NewMail object creates an e-mail message that is based on the fields that are set in the NewMail object, and then the NewMail object writes the .eml file to the location that is specified in the metabase.

CDONTS is now complete. The remainder of the process is completed by the SMTP service.

back to the top

TROUBLESHOOTING

You can use the techniques that follow for troubleshooting.

back to the top

Recognizing the errors that are indicated by object error messages

You may receive the following error messages:

Error message 1
Runtime error 429 - ActiveX Can't create object
Error message 2
Error '8002801d' Library not registered
For more information about error 8002801d, click the following article number to view the article in the Microsoft Knowledge Base:

259176 Error 8002801d occurs when you create a CDONTS.NewMail object

You may receive these error messages for the following reasons:
  • When the process searches the registry to find the location of the Cdonts.dll file, the process may be denied access to the registry keys, or the registry keys may not exist in the registry.

    To resolve this problem, make sure that the SMTP service for IIS is installed, that the Cdonts.dll file exists on the computer, and that the Cdonts.dll file is registered.

    If the Cdonts.dll file is not registered, follow these steps to register the file:

    Click Start, click Run, type Regsvr32 CDONTS.dll, and then click OK.
  • ASP is running on a terminal server. For more information about this error message, click the following article number to view the article in the Microsoft Knowledge Base:

    217067 BUG: CDONTS NewMail object fails on terminal server client

  • Permission issues exist. To determine whether permission issues are the problem, log on to the computer with Administrative permissions. Create a .vbs file on your desktop by using the sample code that is provided in the How CDONTS works section. Do not use the .asp tags.

    As another troubleshooting technique for permission issues, you can set up the virtual directory in IIS to use Basic authentication only, and then access the page as the Administrator.

    If permission issues still exist, remove the SMTP service for IIS, reinstall the SMTP service for IIS, and then reinstall the Windows NT Option Pack 4.
back to the top

Recognizing the error message that occurs when you send a message

When you try to send a message, you may receive the following error message:
Microsoft VBScript runtime error '800a0046' Permission denied
For more information about this error message, click the following article number to view the article in the Microsoft Knowledge Base:

286301 Run-time error 800a0046 with CDONTS.NewMail object

This problem occurs when an application is run out-of-process in IIS. When this problem occurs, the user context of the process changes from the IUSR_MachineName account that does have access to the IIS metabase to the IWAM_MachineName account that does not have access to the IIS metabase.

Typically, this error has two causes.

Cause 1 The user under whom the .asp page is running or the script is running does not have permissions to the Pickup directory. Typically, the Pickup directory is found in the following locations:
  • For computers that are running IIS only:

    C:\Inetpub\Mailroot\Pickup

  • For computers that are running Microsoft Exchange 5.5:

    Exchsrvr\Mailroot\Pickup

  • For computers that are running Exchange 2000:

    \Program files\Exchsrvr\Mailroot\Vsi #\Pickup

The user under whom the .asp page is running or the script is running must have Modify (Change) permission to the Pickup directory so that the NewMail object can create the .eml file.

Cause 2 The page is running in its own memory space and is being denied access to the IIS metabase. To verify this, follow these steps:
  1. Click Start, click Run, type Inetmgr, and then click OK.
  2. Right-click either the root directory or the virtual directory that contains your page, and then click Properties.
  3. If you right-clicked the root directory in step 2, click the Home Directory tab.

    If you right-clicked the virtual directory in step 2, click the Virtual Directory tab.
  4. On a computer that is running Windows NT, determine whether the Run in separate memory space check box is checked. If the Run in separate memory space check box is checked, click to clear the check box. Alternatively, on the Properties menu of the SMTP service, click the Operators tab, and then add the IWAM_MachineName account.

    On a computer that is running Windows 2000, determine whether the Application Protection setting is set to High (Isolated). If the Application Protection setting is set to High (Isolated), set the Application Protection setting to Medium (Pooled). Alternatively, on the Properties menu of the SMTP service, click the Security tab, and then add the IWAM_MachineName account to the Operators account.
back to the top

Recognizing an MTS bug

Because of a Microsoft Transaction Server (MTS) bug, you may receive the following error messages:

Error message 1
Send method error '8009000d' method '~' of object '~' failed
For more information about this error message, click the following article number to view the article in the Microsoft Knowledge Base:

235541 CDONTS application running in MTS fails: "Error 800900d"

Error message 2
Error Code -2146893811 0x8009000D 'Key Does Not Exist'
To resolve this problem, install Windows NT 4.0 Service Pack 6. Alternatively, you can use the workarounds that are described in the previous articles in this section.

back to the top

Recognizing a path error

You may receive the following error messages:

Error message 1
ERROR_SHARING_VIOLATION
Error message 2
SMTP ERROR: 80070020: The process cannot access the file because it is being used by another process
These error messages may occur for the following reasons:
  • The path of the Pickup directory that is specified in the IIS metabase is incorrect or the metabase is corrupted. To resolve this problem, use the AdsUtil.vbs utility to determine where the metabase is pointing to for the path for the Pickup directory. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

    238956 Error 80070003 "Path not found error"

  • The error messages may occur on a computer that is running Windows NT 4.0 Server if you are sending multiple messages, and if you have not applied the fix to this bug. For more information about the fix, click the following article number to view the article in the Microsoft Knowledge Base:

    181697 FIX: Problems sending many messages using multiple threads

back to the top

Retrieving messages from the BadMail directory

After the CDONTS object writes the .eml file to the Pickup directory, the SMTP service takes over. The SMTP service moves the message to the Queue directory for processing. If anything is wrong with the e-mail message, the e-mail message goes directly to the BadMail directory. If anything is wrong with the SMTP service, the e-mail message goes to the BadMail directory, or the e-mail message stays in the queue, and a returned (.rtr) file is created.

If the message goes directly to the BadMail directory, open the message by using Notepad. Make sure that the X-Sender field and the X-Receiver field contain valid e-mail addresses. Make sure that a friendly name is not used in the From field. A friendly name may or may not work. This depends on the following:
  • The service provider that you are using.
  • The smart host settings that may not be valid.
back to the top

Retrieving messages from the Pickup directory

If the message stays in the Pickup directory, make sure that the SMTP service is running. The mail may stay in the Pickup directory if Exchange Internet Mail Service (IMS) is running on the same computer as the IIS SMTP service. You can have either the Exchange IMS running or the IIS SMTP service running but not both.

If your computer is running Exchange IMS, and the mail stays in the Pickup directory under C:\Inetpub\Mailroot, the IIS metabase is pointing at the wrong location. You must change the IIS metabase so that the IIS metabase points to C:\Exchsrvr\Imcdata\Pickup. You can use the AdsUtil.vbs utility to make this change. For more information about pointing to a location, click the following article number to view the article in the Microsoft Knowledge Base:

238956 Error 80070003 "Path not found error"

To verify that the SMTP service is running, follow these steps:

Click Start, click Run, type Telnet localhost 25, and then click OK.

If you receive a return code of 220, the SMTP service is running. If you are disconnected, the SMTP service is not running.

back to the top

Retrieving messages from the Queue directory

If the mail stays in the Queue directory, and if an .rtr file is created, open the .rtr file by using Notepad. You may be able to determine the problem by looking at the .rtr file in Notepad.

back to the top

Troubleshooting summary

If the problems are not resolved by using these troubleshooting techniques, you may have to contact an engineer to verify that the problems occur because of the IIS SMTP service. However, before you do this, you may want to test the SMTP service manually.

For more information about testing the Windows 2000 IIS SMTP service, click the following article number to view the article in the Microsoft Knowledge Base:

286421 How to test Windows 2000 IIS SMTP services manually

For more information about how test the SMTP service for Windows NT 4.0, click the following article number to view the article in the Microsoft Knowledge Base:

153119 Telnet to port 25 to test SMTP communication

back to the top

Modification Type:MajorLast Reviewed:5/12/2006
Keywords:kbtshoot kbinfo KB324649 kbAudDeveloper