Ignore:
Timestamp:
14/09/2007 23:15:18 (5 years ago)
Author:
chris
Message:

Log an error in the System Event Log if sending email fails.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/chris/general/bin/bbackupd/win32/NotifySysAdmin.vbs

    r1830 r1837  
    6666Sub SendMail(from,sendto,subject,body) 
    6767        Set objEmail = CreateObject("CDO.Message") 
     68        Set WshShell = CreateObject("WScript.Shell") 
    6869        Dim cdoschema 
    6970        cdoschema = "http://schemas.microsoft.com/cdo/configuration/" 
     71         
    7072        With objEmail 
    7173                .From = from 
     
    8082                End If 
    8183        End With 
    82         objEmail.Send 
     84        On Error Resume Next 
     85        rc = objEmail.Send 
     86        If rc Then 
     87                WshShell.Exec "eventcreate /L Application /ID 201 /T WARNING " _ 
     88                        & "/SO ""Box Backup"" /D """ & args(0) _ 
     89                        & " notification sent to " & sendto & ".""" 
     90        Else 
     91                WshShell.Exec "eventcreate /L Application /ID 202 /T ERROR " _ 
     92                        & "/SO ""Box Backup"" /D ""Failed to send " & args(0) _ 
     93                        & " notification to " & sendto & ".""" 
     94        End If 
    8395End Sub 
Note: See TracChangeset for help on using the changeset viewer.