Microsoft KB Archive/910360

= How to troubleshoot the &quot;Could not create 'CDO.Message'&quot; error message =

Article ID: 910360

Article Last Modified on 3/16/2007

-

APPLIES TO


 * Microsoft Collaboration Data Objects 2.0

-



Important This article contains information about how to modify the registry. Make sure to back up the registry before you modify it. Make sure that you know how to restore the registry if a problem occurs. For more information about how to back up, restore, and modify the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows registry



SUMMARY
This article describes how to troubleshoot the &quot;Could not create 'CDO.Message'&quot; error message. You may receive this message when you use an application to send e-mail messages.



MORE INFORMATION
The error message is caused by an issue in Microsoft Collaboration Data Objects (CDO). This issue occurs if one or more of the following conditions are true:
 * The Cdosys.dll file is not correctly registered.
 * The user account does not have sufficient permissions to access the registry key for CDO for Microsoft Windows 2000 Library (Cdosys.dll).
 * An invalid Simple Mail Transfer Protocol (SMTP) virtual server is being used, or the SmtpMail.SmtpServer property is incorrectly configured.
 * The user does not have permissions to relay e-mail messages through the SMTP virtual server.
 * The MailMessage.From property is not set to a valid e-mail address.

You may use one or more of the following methods to resolve the CDO issue.Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall your operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.

Method 1: Make sure that the Cdosys.dll file is correctly registered
 Determine whether the Cdosys.dll file is correctly registered. To do this, follow these steps:  Click Start, click Run, type regedt32, and then click OK. In Registry Editor, locate and then expand the HKEY_CLASSES_ROOT registry subtree. Expand TypeLib, and then locate {CD000000-8B95-11D1-82DB-00C04FB1625D}. Expand {CD000000-8B95-11D1-82DB-00C04FB1625D}, expand 1.0, and then click 0. Click win32, and then confirm that the following value is displayed in the right panel:



  Register the Cdosys.dll file. To do this, follow these steps:  Click Start, click Run, type regsvr32 %systemroot%\system32\cdosys.dll, and then click OK.

Note You may receive the 0x800704da error code if multiple versions of CDO exist on the same operating system. To resolve this issue, use the regsrv32 -u cdosys.dll command to unregister the Cdosys.dll file. Then, reregister the Cdosys.dll file by running the following command:

regsvr32 %systemroot%\system32\cdosys.dll

For more information about CDO versions, visit the following Microsoft Developer Network (MSDN) Web site:

http://msdn2.microsoft.com/en-us/library/ms978698.aspx

</li></ol> </li></ol>

Method 2: Grant permissions for the user account to access the registry key for CDO for Windows 2000 Library

 * 1) Grant permission for the user account to access the registry key for CDO for Windows 2000 Library.
 * 2) Click Start, click Run, type regedt32, and then click OK.
 * 3) In Registry Editor, locate and expand the HKEY_CLASSES_ROOT registry key. Expand TypeLib, and then locate {CD000000-8B95-11D1-82DB-00C04FB1625D}.
 * 4) Right-click {CD000000-8B95-11D1-82DB-00C04FB1625D}, click Permissions, and then click Add.
 * 5) Type  \, and then click OK

Note The placeholder  represents the name of the computer. The placeholder  represents the name of the user.
 * 1) Click to select the check box in the Allow column to grant Read permission to the user, and then click OK.

Method 3: Verify that the SmtpMail.SmtpServer property is set to a valid server IP address
Make sure that you know the IP address of a valid SMTP mail server on the network. Then, set the value of the SmtpMail.SmtpServer property to the valid value.

Method 4: Configure the user permissions to relay e-mail messages through the SMTP service

 * 1) Click Start, click Run, type inetmgr, and then click OK.
 * 2) Expand  , and then right-click a valid SMTP virtual server.

Note The placeholder  represents the name of the local computer.
 * 1) Click Properties. On the Security tab, add the user account as an Operator.
 * 2) Close all dialog boxes, and then restart the SMTP service.

Method 5: Make sure that the MailMessage.From property is set to a valid e-mail address
Use a valid sender e-mail address that exists on the SMTP server. The SmtpMail.SmtpServer property points to this server. Do not use a different fictitious address for the value of the MailMessage.From property.

You can configure the Cdosys.dll file to point to SMTP servers programmatically. This option gives developers flexibility in configuring SMTP servers based on the servers' application settings. The following is example code in a Microsoft Visual C# Web application. using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Web.Mail;

namespace WebApplication1 {   ///     /// Summary description for WebForm1. ///    public class WebForm1 : System.Web.UI.Page {       private void Page_Load(object sender, System.EventArgs e)        { MailMessage mail = new MailMessage; mail.To = &quot;<john@contoso.com>&quot;; mail.From = &quot;<ruth@contoso.com>&quot;; mail.Subject = &quot;This is a test email.&quot;; mail.Body = &quot;Some text goes here&quot;; // The following line will cause an exception to be thrown. SmtpMail.SmtpServer = &quot;172.16.0.0&quot;; try {               SmtpMail.Send(mail); }           catch(Exception ex ) {               Response.Write(&quot;The following exception occurred: &quot;  + ex.ToString ); // Check the InnerException. while( ex.InnerException != null ) {                   Response.Write(&quot;&quot;); Response.Write(&quot;The following InnerException reported: &quot; + ex.InnerException.ToString ); ex = ex.InnerException; }           }        }

#region Web Form Designer generated code override protected void OnInit(EventArgs e)       { //           // CODEGEN: This call is required by the ASP.NET Web Form Designer. //           InitializeComponent; base.OnInit(e); }       ///         /// Required method for Designer support - do not modify /// the contents of this method with the code editor. ///        private void InitializeComponent {               this.Load += new System.EventHandler(this.Page_Load);

}       #endregion } } Note The placeholders  and   represent the actual e-mail addresses of the users.

<div class="references_section">