February 16, 2010 at 4:19 am
' Get command line parameters
Dim ArgObj
Set ArgObj = WScript.Arguments
Dim strFrom, strTo, strSubject, strBody
strFrom = "SQL-Cluster <SQL-Cluster@here.com>"
strTo = "Mike <mike.metcalf@4projects.com>"
strSubject = "Automated CPU Alert from SQL-Cluster"
' get the body from the command line
If ArgObj.Count > 0 Then
strBody = ArgObj( 0 )
' if the subject is specified as an argument then add it
If ArgObj.Count > 1 Then
strSubject = ArgObj( 1 )
End If
Else
strBody = "Default alert message body"
End if
Call SendEmail( strFrom, strTo, strSubject, strBody )
' release memory
Set ArgObj = Nothing
' Sub-routing to send an e-mail using the CDO component
Sub SendEmail(sFromEmail, sToEmail, sSubject, sText )
Dim objMail
Set objMail = CreateObject( "CDO.Message" )
objMail.From = sFromEmail
objMail.To = sToEmail
objMail.Subject = sSubject
' Send using an SMTP server
objMail.Configuration.Fields.Item = 2
' Name or IP of remote SMTP server
objMail.Configuration.Fields.Item= "SMTP server IP"
' Server port
objMail.Configuration.Fields.Item= 25
objMail.Configuration.Fields.Update
objMail.TextBody = sText
objMail.Send
Set objMail = nothing
End Sub
I got from script as (http://www.sqlservercentral.com/articles/Administration/smtpsqlserverperformancealerts/2005/)
The above VBscript does not working, tried this command CSCRIPT "C:\Program Files\VBS Scripts\send-mail.vbs" it is not hope.
Viewing post 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply