Platform SDK: CDO for Windows 2000

Configuring Network Authentication Information

When sending or posting messages over the network, many SMTP and NNTP services require clients to authenticate themselves. To configure a Message object for authentication, perform the following steps:

  1. Set the http://schemas.microsoft.com/cdo/configuration/smtpauthenticate or http://schemas.microsoft.com/cdo/configuration/nntpauthenticate fields in the Configuration object's IConfiguration.Fields collection. The possible values are defined by the CdoProtocolsAuthentication enumeration.
  2. If the mechanism is set to cdoBasic, set the user name and password. For SMTP, set the http://schemas.microsoft.com/cdo/configuration/sendusername and http://schemas.microsoft.com/cdo/configuration/sendpassword configuration fields.

    For NNTP, set the http://schemas.microsoft.com/cdo/configuration/postusername and http://schemas.microsoft.com/cdo/configuration/postpassword fields.

When using the NTLM authentication mechanism, the current process and/or thread's security context is used.

[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
' Use string constants provided in the type library
' for field names (they are long)
Flds(cdoSendUsingMethod)           = cdoSendUsingPort
Flds(cdoSMTPServer)                = "mail.microsoft.com"
Flds(cdoSMTPServerPort)            = 26
Flds(cdoSMTPConnectionTimeout)     = 30
Flds(cdoSMTPAccountName)           = "My Name"
Flds(cdoSendUserReplyEmailAddress) = """User"" <user@microsoft.com>"
Flds(cdoSendEmailAddress)          = """User"" <user@microsoft.com>"
Flds(cdoSMTPAuthenticate)          = cdoBasic
Flds(cdoSendUserName)              = "name"
Flds(cdoSendPassword)              = "password"
Flds.Update

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

' go on to use Message instance

See Also

http://schemas.microsoft.com/cdo/configuration/smtpauthenticate

http://schemas.microsoft.com/cdo/configuration/nntpauthenticate

http://schemas.microsoft.com/cdo/configuration/sendusername

http://schemas.microsoft.com/cdo/configuration/sendpassword

http://schemas.microsoft.com/cdo/configuration/postusername

http://schemas.microsoft.com/cdo/configuration/postpassword