Sunday, June 12, 2005

Sending mails using network IIS server

Const cdoSendUsingPort = 25
Const strSmartHost = "{specify the smart host}"

'Create the message object.
Set objMessage = CreateObject("CDO.Message")

'Create the configuration object.
Set objConf = objMessage.Configuration

'Set the fields of the configuration object to send by using SMTP through port 25.
With objConf.Fields
.item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost
.Update
End With

'Set the To, From, Subject, and Body properties of the message.
With objMessage
.To = strTo
.From = strFrom
.Subject = strSubject
.TextBody = strBody
.Send
End With

set objMessage = Nothing

No comments: