Const Email_From = "[email protected]"
 Const Password = "password"
 Const Email_To = "[email protected]"
 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环境调试。

05-08 15:03