Thursday, September 27, 2007

VBScript to send Email

'Script Start


Set objEmail = CreateObject("CDO.Message")

'Change from field
objEmail.From = "admin1@fabrikam.com"

'change to field
objEmail.To = "admin2@fabrikam.com"

'change subject
objEmail.Subject = "Server down"

'change textbody
objEmail.Textbody = "Server1 is no longer accessible over the network."


objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "Your mail server IP - HERE"
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send



'Script End



How to execute a VBScript

No comments: