1 ConstEmail_from ="[email protected]"2 ConstPassword ="Password"3 ConstEmail_to ="[email protected]"4 SetCDO =CreateObject("CDO. Message")5Cdos. Subject ="Test"6Cdos. from =Email_from7Cdos. to =email_to8Cdos. TextBody ="Hello world!"9 Constschema ="http://schemas.microsoft.com/cdo/configuration/"Ten withCDO. Configuration.fields One. Item (Schema &"sendusing") =2 A. Item (Schema &"SmtpServer") ="smtp.163.com" -. Item (Schema &"smtpauthenticate") =1 -. Item (Schema &"Sendusername") =Email_from the. Item (Schema &"Sendpassword") =Password -. Item (Schema &"Smtpserverport") = - -. Item (Schema &"Smtpusessl") =True -. Item (Schema &"Smtpconnectiontimeout") = - + . Update - End with +Cdos. Send
Save the above code to Sendemail.vbs, enter the directory by command, and input sendemail.vbs execute.
VBScript debugs in the Windows environment, input cscript sendemail.vbs//x in the command, and can enter VS environment debugging.
VBScript uses Cdo.message to send mail