[Box Backup-commit] COMMIT r1837 - box/chris/general/bin/bbackupd/win32

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Fri Sep 14 23:15:18 BST 2007


Author: chris
Date: 2007-09-14 23:15:18 +0100 (Fri, 14 Sep 2007)
New Revision: 1837

Modified:
   box/chris/general/bin/bbackupd/win32/NotifySysAdmin.vbs
Log:
Log an error in the System Event Log if sending email fails.


Modified: box/chris/general/bin/bbackupd/win32/NotifySysAdmin.vbs
===================================================================
--- box/chris/general/bin/bbackupd/win32/NotifySysAdmin.vbs	2007-09-14 22:12:28 UTC (rev 1836)
+++ box/chris/general/bin/bbackupd/win32/NotifySysAdmin.vbs	2007-09-14 22:15:18 UTC (rev 1837)
@@ -65,8 +65,10 @@
 
 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 @@
 			.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




More information about the Boxbackup-commit mailing list