码迷,mamicode.com
首页 > 其他好文 > 详细

VBScript使用CDO.Message发送邮件

时间:2015-07-31 23:11:48      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:

 1 Const Email_From = "from@163.com"
 2 Const Password = "password"
 3 Const Email_To = "to@qq.com"
 4 Set CDO = CreateObject("CDO.Message")
 5 CDO.Subject = "Test"
 6 CDO.From = Email_From
 7 CDO.To = Email_To
 8 CDO.TextBody = "Hello world!"
 9 Const schema = "http://schemas.microsoft.com/cdo/configuration/"
10 With CDO.Configuration.Fields
11 .Item(schema & "sendusing") = 2
12 .Item(schema & "smtpserver") = "smtp.163.com"
13 .Item(schema & "smtpauthenticate") = 1
14 .Item(schema & "sendusername") = Email_From
15 .Item(schema & "sendpassword") = Password
16 .Item(schema & "smtpserverport") = 25
17 .Item(schema & "smtpusessl") = True
18 .Item(schema & "smtpconnectiontimeout") = 60
19 .Update
20 End With
21 CDO.Send 

将以上代码保存成sendemail.vbs,通过命令进入到该目录下,输入sendemail.vbs执行。

 

VBScript在windows环境下调试,命令中输入cscript sendemail.vbs //x,可以进入VS环境调试。

VBScript使用CDO.Message发送邮件

标签:

原文地址:http://www.cnblogs.com/yangtze-yufei/p/4693236.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!