我正在尝试ping通某些站点和IP地址,并将结果存储在txt文件中。 该文件需要使用VBScript自动通过电子邮件发送。 我编写了用于发送有效电子邮件的脚本,但无法弄清楚如何发送附件或从电子邮件正文中的txt文件导入文本。
vbs的代码是:
Set emailObj = CreateObject("CDO.Message")
emailObj.From = "boda85@gmail.com"
emailObj.To = "bogdanprascevic1985@gmail.com"
emailObj.Subject = "Test internet and network connection"
emailObj.TextBody = "Body text"
Set emailConfig = emailObj.Configuration
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "boda85"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
emailConfig.Fields.Update
emailObj.Send
If err.number = 0 then Msgbox "Done"