Sub SendEmail_CDO(ByVal sendto As String, ByVal subject As String, ByVal body As String, ByVal server As String)
Dim iMsg As Object
Dim iConf As Object
Dim Flds As Object
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = server
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Update
End With
With iMsg
Set .Configuration = iConf
.to = sendto
.CC = ""
.BCC = ""
.From = """TEST"" "
.subject = subject
.TextBody = body
.Send
End With
End Sub
|