This article describes how to troubleshoot the "Could not
create 'CDO.Message'" error message. You may receive this message when you use
an application to send e-mail messages.
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:
Drive:\WINDOWS\system32\cdosys.dll
- 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:
Method 2: Grant permissions for the user account to access the registry key for CDO for Windows 2000 Library
- Grant permission for the user account to access the
registry key for CDO for Windows 2000 Library.
- Click Start, click Run,
type regedt32, and then click OK.
- In Registry Editor, locate and expand the
HKEY_CLASSES_ROOT registry key. Expand
TypeLib, and then locate
{CD000000-8B95-11D1-82DB-00C04FB1625D}.
- Right-click
{CD000000-8B95-11D1-82DB-00C04FB1625D}, click
Permissions, and then click Add.
- Type
ComputerName\UserName,
and then click OK
Note The placeholder ComputerName
represents the name of the computer. The placeholder
UserName represents the name of the user. - 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
- Click Start, click Run,
type inetmgr, and then click
OK.
- Expand
ComputerName, and then right-click
a valid SMTP virtual server.
Note The placeholder ComputerName
represents the name of the local computer. - Click Properties. On the
Security tab, add the user account as an Operator.
- 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>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
MailMessage mail = new MailMessage();
mail.To = "<john@contoso.com>";
mail.From = "<ruth@contoso.com>";
mail.Subject = "This is a test email.";
mail.Body = "Some text goes here";
// The following line will cause an exception to be thrown.
SmtpMail.SmtpServer = "172.16.0.0";
try
{
SmtpMail.Send(mail);
}
catch(Exception ex )
{
Response.Write("The following exception occurred: " + ex.ToString() );
// Check the InnerException.
while( ex.InnerException != null )
{
Response.Write("--------------------------------");
Response.Write("The following InnerException reported: " + 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);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
Note The placeholders
<john@contoso.com> and
<ruth@contoso.com> represent the actual e-mail
addresses of the users.
For more information, click the following
article numbers to view the articles in the Microsoft Knowledge Base:
827659
(http://support.microsoft.com/kb/827659/
)
You receive a "DllRegisterServer" error when you try to register a DLL by using Regsvr32.exe
327219
(http://support.microsoft.com/kb/327219/
)
Collaboration data objects for Windows NT, for Windows 2000, and for Exchange 2000 require Outlook Express