Send an email (VBScript)

This code can be found in Chapter 16 of Active Directory Cookbook, 2nd edition

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the VBScript code from this site.

' This code will send a simple email message
' from a computer that is running its own SMTP server

'------------Script Configuration--------------------
strSubject = "Low hard disk space on server dc1." 
strFromLine = "admin@rallencorp.com"
strToLine = "oncall@rallencorp.com"
strText = "Available disk space on the C:\ drive of dc1." & _
  "rallencorp.com has gone below 100MB."
'----------------------------------------------------

Set objMessage = CreateObject("CDO.Message") 
objMessage.Subject = strSubject 
objMessage.From = strFromLine 
objMessage.To = strToLine 
objMessage.TextBody = strText
objMessage.Send

This code has been viewed 4962 times.

New from the creators of TechTasks.com: StatSheet.com