Function Main() Dim sFrom Dim sTo Dim sCc Dim sSubject Dim sTextBody Dim sAttach Dim objMail Dim iMsg Dim iConf Dim Flds Const cdoSendUsingPort = 2 'MsgBox DTSGlobalVariables("Connection_EHSDW").Value Set cn = CreateObject("ADODB.Connection") cn.Open DTSGlobalVariables("Connection_EHSDW").Value Set rs = cn.Execute("SELECT mail_from, mail_to, mail_cc, mail_subject, textbody, attachment_path FROM t_wims_mailing_list WHERE module = 'Claims' and task = 'Daily Claims Summary'" ) If Not rs.EOF Then sTo = rs("mail_to") sCc = rs("mail_cc") sFrom = rs("mail_from") sSubject = rs("mail_subject") sTextBody = rs("textbody") sAttach = rs("attachment_path") End If set iMsg = CreateObject("CDO.Message") set iConf = CreateObject("CDO.Configuration") Set Flds = iConf.Fields With Flds .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = _ cdoSendUsingPort .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _ "mailserv.mmm.com" .Update End With iMsg.configuration = iConf iMsg.To = sTo iMsg.From = sFrom iMsg.Subject = sSubject iMsg.TextBody = sTextBody iMsg.AddAttachment sAttach iMsg.Send Set objMail = Nothing Set oRS = Nothing Main = DTSTaskExecResult_Success End Function
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)