Microsoft KB Archive/265527

= Error '8004020A' when you try to send mail with CDOSYS =

Article ID: 265527

Article Last Modified on 2/12/2007

-

APPLIES TO


 * Microsoft Collaboration Data Objects 2.0

-



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 - &quot;The SMTP server name is required, and was not found in the configuration source&quot;



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(&quot;http://schemas.microsoft.com/cdo/configuration/SMTPServer&quot;) = &quot;myserver&quot; The following line is the correct syntax for the SMTP server configuration field namespace:

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



STATUS
This behavior is by design.



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(&quot;CDO.Message&quot;) Set objConfig = CreateObject(&quot;CDO.configuration&quot;)

Set objFields = objConfig.Fields

With objFields .Item(&quot;http://schemas.microsoft.com/cdo/configuration/SendUsing&quot;)= 2 .Item(&quot;http://schemas.microsoft.com/cdo/configuration/SMTPServer&quot;)= &quot; &quot; .Item(&quot;http://schemas.microsoft.com/cdo/configuration/SMTPServerPort&quot;)= 25 .Update End With

With objMail Set .Configuration = objConfig .To           = &quot;&quot;&quot;Your Name&quot;&quot; &quot; .From         = &quot;&quot;&quot;Your Name&quot;&quot; &quot; .Subject      = &quot;This is a test&quot; .Send End With

This code generates the error message 8004020A.

Keywords: kbmsg kbprb KB265527

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.