|
Function SendMail(Message,Body,ToList,CcList,Attachment)
NameSpace = "http://schemas.microsoft.com/cdo/configuration/"
Set Email = CreateObject("CDO.Message")
Email.From = "test@163.com.cn"
Email.To = ToList
Email.Cc = CcList
Email.Subject = Message
Email.Textbody = Body
Email.AddAttachment Attachment
Email.DSNOptions = 1
Email.Configuration.Fields.Item(NameSpace&"sendusing") = 2
Email.Configuration.Fields.Item(NameSpace&"smtpserver") = Environment("Mail_Server")
Email.Configuration.Fields.Item(NameSpace&"smtpserverport") = 25
Email.Configuration.Fields.Item(NameSpace&"smtpauthenticate") = 1
Email.Configuration.Fields.Item(NameSpace&"sendusername") = Environment("Mail_account")
Email.Configuration.Fields.Item(NameSpace&"sendpassword") = Environment("Mail_pwd")
Email.Configuration.Fields.Update()
Email.Send
End Function |
|