|
Function sendmail(touser,fromuser,txtfile,title,name,pwd)'邮件发送
NameSpace = "http://schemas.microsoft.com/cdo/configuration/"
Set Email = CreateObject("CDO.Message")
Email.From = fromuser '发信人地址
Email.To = touser '收信人地址
Email.Subject = title '邮件主题
Email.Textbody="#######"&vbcrlf&now
Email.AddAttachment newfileMT'添加附件
with Email.Configuration.Fields
.Item(NameSpace&"sendusing") = 2
.Item(NameSpace&"smtpserver") = "****.com" '这是126邮箱的服务器地址
.Item(NameSpace&"smtpserverport") = 25
.Item(NameSpace&"smtpauthenticate") = 1
.Item(NameSpace&"sendusername") = name '发信人用户名
.Item(NameSpace&"sendpassword") = pwd '发信人密码
.Update
End With
Email.Send
Set Email=Nothing
End Function
LZ参考下,这是我们目前用的邮件发送代码,可用 |
|