VBScript使用CDO.Message发送邮件

 Const Email_From = "from@163.com"
 Const Password = "password"
 Const Email_To = "to@qq.com"
 Set CDO = CreateObject("CDO.Message")
 CDO.Subject = "Test"
 CDO.From = Email_From
 CDO.To = Email_To
 CDO.TextBody = "Hello world!"
 Const schema = "http://schemas.microsoft.com/cdo/configuration/"
 With CDO.Configuration.Fields
 .Item(schema &
 .Item(schema & "smtpserver") = "smtp.163.com"
 .Item(schema &
 .Item(schema & "sendusername") = Email_From
 .Item(schema & "sendpassword") = Password
 .Item(schema &
 .Item(schema & "smtpusessl") = True
 .Item(schema &
 .Update
 End With
 CDO.Send 

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

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

上一篇:Oracle数据库创建表空间及用户授权


下一篇:mysql查询优化器的提示(hit)