CDO_Message.txt
Display Object
'This script has been proven to work, as is, on our servers.
'Just compose the values and pass them to the function.
'
'Example: Call EmailEngine("me@here.com", MySubject, FormEmail, "", "", "", MyMessage, "")
'sends a plain text email
'To: FormEmail (variable in calling ASP script)
'From: me@here.com (hard coded into the Call statement)
'Subject: MySubject (variable from calling ASP script)
'MessageBody: MyMessage (composed in calling ASP script)
'No cc, no Bcc, no attachment
'
'
Function EmailEngine (FromField, SubjectField, ToField, CCField, BCCField, HTMLBodyPart, TextBodyPart, AttachFilePath)
Dim iMsg
Dim iConf
Dim Flds
Dim strHTML

Const cdoSendUsingPickup = 1

set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")

Set Flds = iConf.Fields

With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPickup
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory")="c:\Inetpub\mailroot\pickup"
.Update
End With

With iMsg
Set .Configuration = iConf
.From = FromField
.Subject = SubjectField
.To = ToField
.cc = CCField
.bcc = BCCField
If HTMLBodyPart = "" Then
.TextBody = TextBodyPart
Else
.HTMLBody = HTMLBodyPart
End If
If AttachFilePath <> "" Then
.addattachment AttachFilePath
End If
.send
End With

Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing

End Function