标签:style blog http io color os sp on div
原理:建立CDO.Message对象,设置好参数后直接Send就可以了
代码如下:
NameSpace = "http://schemas.microsoft.com/cdo/configuration/" Set Email = CreateObject("CDO.Message") Email.From = "你的Email地址" Email.To = "接收方的Email地址" Email.Subject = "主题" Email.Textbody = "正文" ‘Email.AddAttachment="附件" With Email.Configuration.Fields .Item(NameSpace&"sendusing") = 2 .Item(NameSpace&"smtpserver") = "smtp服务器地址" .Item(NameSpace&"smtpserverport") = 25 .Item(NameSpace&"smtpauthenticate") = 1 .Item(NameSpace&"sendusername") = "用户名" .Item(NameSpace&"sendpassword") = "密码" .Update End With ‘设定好参数发送 Email.Send
运行脚本即可发送邮件。可以用Windows的计划任务定时运行脚本,实现定时发送邮件:
at time cmd
将两者合写成.bat直接运行就好了0.0
标签:style blog http io color os sp on div
原文地址:http://www.cnblogs.com/lyqatdl/p/4123189.html