Configuring the Message Object

Configuring the Message Object

To configure a Message object, you perform the following steps:

  1. Create an instance of the Configuration COM class.
  2. Populate the configuration settings in the IConfiguration.Fields collection.
  3. Set the IMessage.Configuration property to the IConfiguration object reference on the Configuration object.
' 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
Flds(cdoSendUsingMethod) = cdoSendUsingPort
Flds(cdoSMTPServer) = "mail.example.com"
' ... other settings
Flds.Update

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

' go on to use Message object