Platform SDK: CDO for Windows 2000

Sending or Posting Using the Network

Perform the following steps to send messages over the network.

  1. Set the http://schemas.microsoft.com/cdo/configuration/sendusing or http://schemas.microsoft.com/cdo/configuration/postusing field to cdoSendUsingPort or CdoPostUsingPort in the Configuration object
  2. Set the http://schemas.microsoft.com/cdo/configuration/smtpserver or http://schemas.microsoft.com/cdo/configuration/nntpserver to a resolvable name—Domain Name System (DNS) or network basic input/output system (NetBIOS)—for an SMTP or NNTP service on the network.
  3. Set additional fields used with network configurations. These are listed in the following table.
    Name Description
    smtpserverport

    nntpserverport

    The port to use when connecting the SMTP or NNTP service. Defaults are 25 and 119 respectively.
    smtpconnectiontimeout

    nntpconnectiontimeout

    The timeout in seconds for attempted connections to the service. Default is 30 seconds.
    smtpaccountname

    nntpaccountname

    The SMTP account name.
    smtpauthenticate

    nntpauthenticate

    The mechanism (if any) used to authenticate with the service.
    smtpusessl

    nntpusessl

    A boolean flag indicating whether to use Secure Sockets Layer (SSL) for the connection.

The following example demonstrates how to explicitly set the various fields used when sending messages over the network. Note the use of the constants found in the CDO type library.

[Visual Basic]
' Reference to Microsoft ActiveX Data Objects 2.5 Library
' Reference to Microsoft CDO for Windows 2000 Library
Dim iConf As New CDO.Configuration
Dim Flds  As ADODB.Fields
Set Flds  = iConf.Fields

' Set the configuration for Network Send
Flds(cdoSendUsingMethod)          = cdoSendUsingPort
Flds(cdoSMTPServer)               = "mail.microsoft.com"
Flds(cdoSMTPServerPort)           = 25
Flds(cdoSMTPConnectionTimeout)    = 30
Flds(cdoSMTPAccountName)          = "My Name"
Flds(cdoSendUserReplyEmailAddress)= """User"" <user@microsoft.com>"
Flds(cdoSendEmailAddress)         = """User"" <user@microsoft.com>"
' ... other settings
Flds.Update

Dim iMsg As New CDO.Message
Set iMsg.Configuration = iConf

' go on to use Message object 

Many of these settings can be loaded if Microsoft® Outlook® Express is installed on the local computer. Only the settings for the default account and default identity can be used. See Using Default Configuration Settings for more information.

See Also

Sending or Posting Using the Pickup Directory

http://schemas.microsoft.com/cdo/configuration/sendusing Field

http://schemas.microsoft.com/cdo/configuration/postusing Field

http://schemas.microsoft.com/cdo/configuration/ Name Space