Error '8004020A' when you try to send mail with CDOSYS (265527)



The information in this article applies to:

  • Microsoft Collaboration Data Objects for Windows 2000

This article was previously published under Q265527

SYMPTOMS

When you attempt to send mail using the Microsoft Collaboration Data Objects for Windows 2000 (CDOSYS) library, the following error message occurs:
8004020A - "The SMTP server name is required, and was not found in the configuration source"

CAUSE

This error message occurs if the Simple Mail Transfer Protocol (SMTP) configuration field namespace is not typed with the correct letter case. All of the namespaces in the CDOSYS configuration object are case sensitive.

RESOLUTION

To resolve this behavior, ensure that the SMTP server configuration field namespace has the correct letter case.

Example:

The following line produces the error message on the Send method of the CDOSYS object:

   Fields.Item("http://schemas.microsoft.com/cdo/configuration/SMTPServer") = "myserver"
				
The following line is the correct syntax for the SMTP server configuration field namespace:

   Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "myserver"
				

STATUS

This behavior is by design.

MORE INFORMATION

Steps to reproduce the behavior

Create a file called Test.vbs, and then enter the following code:
Dim objMail
Dim objConfig
Dim objFields

Set objMail = CreateObject("CDO.Message")
Set objConfig = CreateObject("CDO.configuration")

Set objFields = objConfig.Fields

With objFields
 .Item("http://schemas.microsoft.com/cdo/configuration/SendUsing")= 2
 .Item("http://schemas.microsoft.com/cdo/configuration/SMTPServer")= "<yourservername>"
 .Item("http://schemas.microsoft.com/cdo/configuration/SMTPServerPort")= 25
 .Update
End With


With objMail
  Set .Configuration = objConfig
      .To            = """Your Name"" <yourname@yourdomain.com>"
      .From          = """Your Name"" <yourname@yourdomain.com>"
      .Subject       = "This is a test"
      .Send
End With

				
This code generates the error message 8004020A.


Modification Type:MajorLast Reviewed:5/19/2005
Keywords:kbMsg kbprb KB265527