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("", MySubject, FormEmail, "", "", "", MyMessage, "")
'sends a plain text email
'To: FormEmail (variable in calling ASP script)
'From: (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("") = cdoSendUsingPickup
End With

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

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

End Function