我试图复制我在另一个办公室使用的VBscript。如果发生错误,我想发送电子邮件。该过程在Windows 7计算机上运行正常,但Windows 2008 R2域控制器给我一个错误。我安装了MS MAPI / CDO软件包,但没有帮助。它是发送错误的email.send行。
Sub SendAlertEmail
Set email = CreateObject("CDO.Message")
'WScript.Echo"step 1"
email.Subject = "Possible phone time collection failure"
email.From = "user@gmx.com"
email.To = "me@ttt.com"
email.TextBody = Now() & " The collection of phone time that is done on the Broadlook PC seems to have failed. There has been no data for quite a while."
email.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
email.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "ttt@gmx.com"
email.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
email.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
email.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.gmx.com"
email.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
email.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
email.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
email.Configuration.Fields.Update
email.Send
set email = Nothing
'WScript.Echo"step 2"
End Sub