Share via Namespace

The namespace defines the majority of fields used to set configurations for various CDO objects. These configuration fields are set using an implementation of the IConfiguration.Fields collection.

Many CDO objects use information stored in an associated Configuration object to define configuration settings. One example is the Message object, where you use its associated Configuration object to set fields such as sendusing. This field defines whether to send the message using the local SMTP service drop directory (if the local machine has the SMTP service installed), an SMTP service directly over the network. If sending over the network, you set smtpserver to specify the IP address or DNS name of the machine hosting the SMTP service, and optionally, smtpserverport to specify a port value. If credentials are required for connecting to an SMTP service, you can specify them by setting the sendusername and sendpassword.

A similar set of fields exists for posting messages using either a local NNTP service pickup directory, or over the network.

All of the names listed below are also defined as string constants in the type library and IDL file for convenience.

Default Configuration Values

In many cases, you may not wish to explicitly set the configuration for a particular object. The CDO component provides default values for the fields that depend on the software installed on the system.

Outlook Express Settings

With Outlook Express installed on the system, various fields default to the settings associated with the default Outlook Express mail account for the default identity. The possible fields are numerous and not listed here. Check the associated field below for the associated Outlook Express value used as a default.

Both Outlook Express and SMTP/NNTP Service

In the case where both Outlook Express and SMTP/NNTP services exist on the same machine, both default settings are loaded. The sendusing and postusing fields, however, each default to 1, meaning to use the associated pickup directories for the installed services, if that service is installed.


Dim iConfig as new CDO.Configuration
Dim Flds as ADODB.Fields
iConfig.Load cdoSourceIIS

Set Flds = iConfig.Fields
With Flds
  ' Its good practice to use the module constants defined in the
  ' type library for the names.  The full names are used here to
  ' indicate that this is what is going on
  .Item("")      = ""
  .Item("") = 25
  .Item("")  = CdoSendUsingPort
End With
#import "c:\program files\common files\system\ado\msado15.dll" no_namespace
#import <cdosys.dll> no_namespace
#include <cdosysstr.h>  // string constants in this file
    IConfigurationPtr iConf(__uuidof(Configuration));
    FieldsPtr iFields;

    iConf->Load(cdoSourceIIS);  // this string constant from import
    Flds = iConf->Fields;

    = _variant_t("mailserver");
    = _variant_t((long)25);
    = _variant_t((long)cdoSendUsingPort);
    // ...