diff options
author | Chris Wilson <chris+github@qwirx.com> | 2007-10-17 12:49:48 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2007-10-17 12:49:48 +0000 |
commit | d2f15ac17e12d7497922464a5db27f4c917fb54d (patch) | |
tree | e06ce9cfe85a42e28153473928ff691fb71590b0 | |
parent | d23a3df00f15b0eff80781e6582cd315eb261b9b (diff) |
Windows notify script logs an error in the System Event Log if sending
email fails. (merges [1837])
-rw-r--r-- | bin/bbackupd/win32/NotifySysAdmin.vbs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/bin/bbackupd/win32/NotifySysAdmin.vbs b/bin/bbackupd/win32/NotifySysAdmin.vbs index 2ee04acb..49082887 100644 --- a/bin/bbackupd/win32/NotifySysAdmin.vbs +++ b/bin/bbackupd/win32/NotifySysAdmin.vbs @@ -65,8 +65,10 @@ End Function Sub SendMail(from,sendto,subject,body) Set objEmail = CreateObject("CDO.Message") + Set WshShell = CreateObject("WScript.Shell") Dim cdoschema cdoschema = "http://schemas.microsoft.com/cdo/configuration/" + With objEmail .From = from .To = sendto @@ -79,5 +81,15 @@ Sub SendMail(from,sendto,subject,body) .Configuration.Fields.Update End If End With - objEmail.Send + On Error Resume Next + rc = objEmail.Send + If rc Then + WshShell.Exec "eventcreate /L Application /ID 201 /T WARNING " _ + & "/SO ""Box Backup"" /D """ & args(0) _ + & " notification sent to " & sendto & ".""" + Else + WshShell.Exec "eventcreate /L Application /ID 202 /T ERROR " _ + & "/SO ""Box Backup"" /D ""Failed to send " & args(0) _ + & " notification to " & sendto & ".""" + End If End Sub |