VBScript - Send E-Mail with CDO.Message

Some my feel that apart from it being a niftyFor Each objPingStatus In colPingStatus
trick, there isn't any real practical use for sendingIf IsNull(objPingStatus.StatusCode) or
E-Mail from a script but lets imagine the followingobjPingStatus.StatusCode 0 Then
scenario:Set objMessage =
You have a business critical server calledCreateObject("CDO.Message")objMessage.From =
"ImpServ01" that must be available at all costs.strComputer &
The following script can be setup to run every"@YourDomain.com"objMessage.To =
five minutes to check the availability of the""objMessage.Subject = strComputer & " is
server and email you if the server becomesunavailable"objMessage.Textbody = strComputer
unavailable. This example uses a SMTP server& " is no longer accessible over the
called "SMTP.YourDomain.com" and sends mailnetwork."objMessage.Configuration.Fields.Item(" =
from "" to "".2objMessage.Configuration.Fields.Item(" =
Option Explicitelds.Item(" =
Dim strComputer.Send
Dim colPingStatusEnd If
Dim objPingStatusNext
Dim objMessagestrComputer = "ImpSrv01"Set colPingStatus = Nothing
Set colPingStatus =Set objMessage = Nothing
nate}").ExecQuery("SELECT * FROMTo attach a file to the E-Mail add the following
Win32_PingStatus WHERE address = '" &line:objMessage.AddAttachment "SomeDocument.
strComputer & "'")