站长资源脚本专栏

vbs sendmail发邮件带附件方法

整理:jimmy2024/12/27浏览2
简介NameSpace = "http://schemas.microsoft.com/cdo/configuration/" Set Email = CreateObject("CDO.Message") Email.From = "zzzevazzz@21cn.com" Email.To = "zz
NameSpace = "http://schemas.microsoft.com/cdo/configuration/"
Set Email = CreateObject("CDO.Message")
Email.From = "zzzevazzz@21cn.com"
Email.To = "zzzevazzz@126.com"
Email.Subject = "Test sendmail.vbs"
Email.Textbody = "OK!"
Email.AddAttachment "C:\foo.zip"
With Email.Configuration.Fields
.Item(NameSpace&"sendusing") = 2
.Item(NameSpace&"smtpserver") = "smtp.21cn.com" 
.Item(NameSpace&"smtpserverport") = 25
.Item(NameSpace&"smtpauthenticate") = 1
.Item(NameSpace&"sendusername") = "zzzevazzz"
.Item(NameSpace&"sendpassword") = "ph4nt0m!"
.Update
End With
Email.Send