Hi Brandon,

Here's a VBscript we've used for a number of years. Configure it by setting the variable values near the top, and run it as a scheduled process using cscript.

Hope this helps,

Darin.

=======8<======

' ======================
' = Begin Main Section =
' ======================

Dim OverflowFolder
Dim SpoolFolder
Dim OverflowMaxCount
Dim SpoolMaxCount
Dim SMTPServer
Dim SMTPServerPort
Dim AlertTo
Dim AlertSubject
Dim AlertFrom


OverflowFolder        = "C:\Imail\Spool\overflow"
SpoolFolder        = "C:\Imail\Spool"

OverflowMaxCount    = 0
SpoolMaxCount        = 500

SMTPServer        = "<enter your mail server here>"
SMTPServerPort        = 25
AlertTo            = "<email address to alert>"
AlertSubject        = "Mail server in overflow"
AlertFrom        = "<FROM address>"


CheckOverflow()
CheckSpool()


' ====================
' = End Main Section =
' ====================

Sub CheckOverflow()

 Dim fso, folder, files

 Set fso    = wscript.CreateObject("Scripting.FileSystemObject")
 Set folder = fso.GetFolder(OverflowFolder)
 Set files  = folder.Files

 wscript.echo "Time: " & FormatDateTime(Now, 3)
 wscript.echo "Imail Overflow file count: " & files.Count

 If files.Count > OverflowMaxCount Then

   Set files = Nothing
   Set folder = Nothing

   Set folder = fso.GetFolder(SpoolFolder)
   Set files  = folder.Files

   wscript.echo "Imail in overflow."

   ' Send Alert email via alternate server

   Set objMessage = CreateObject("CDO.Message")
   objMessage.Subject = AlertSubject
   objMessage.From = AlertFrom
   objMessage.To = AlertTo
objMessage.TextBody = "Time: " & FormatDateTime(Now, 3) & vbcrlf & vbcrlf & _
               "Imail Overflow file count: " & files.Count

objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing";) = 2 objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver";) = SMTPServer objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport";) = SMTPServerPort
   objMessage.Configuration.Fields.Update

   objMessage.Send

   Set objMessage = Nothing

 End If

Set files = Nothing
Set folder = Nothing
Set fso = Nothing

End Sub

Sub CheckSpool()

 Dim fso, folder, files

 Set fso    = wscript.CreateObject("Scripting.FileSystemObject")
 Set folder = fso.GetFolder(SpoolFolder)
 Set files  = folder.Files

 wscript.echo "Time: " & FormatDateTime(Now, 3)
 wscript.echo "Imail Spool file count: " & files.Count

 If files.Count > SpoolMaxCount Then

   Set files = Nothing
   Set folder = Nothing

   Set folder = fso.GetFolder(SpoolFolder)
   Set files  = folder.Files

   wscript.echo "Imail spool high file count."

   ' Send Alert email via alternate server

   Set objMessage = CreateObject("CDO.Message")
   objMessage.Subject = AlertSubject
   objMessage.From = AlertFrom
   objMessage.To = AlertTo
objMessage.TextBody = "Time: " & FormatDateTime(Now, 3) & vbcrlf & vbcrlf & _
               "Imail Spool file count: " & files.Count

objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing";) = 2 objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver";) = SMTPServer objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport";) = SMTPServerPort
   objMessage.Configuration.Fields.Update

   objMessage.Send

   Set objMessage = Nothing

 End If

Set files = Nothing
Set folder = Nothing
Set fso = Nothing

End Sub
======8<=======



-----Original Message----- From: Brandon Rowlett
Sent: Friday, October 25, 2013 9:08 AM
To: [email protected]
Subject: [MBF]HiJack/Proc Warning

Does anyone have a decent snippet of code that will check on the proc or hold directory that will send an email to alert the administrator if it becomes overrun? A long time ago we used IMail1.exe that would use the built in SMTP server to send out an email but that has long since been discontinued due to security issues.

Thanks,

Brandon Rowlett



CONFIDENTIALITY NOTICE: This message, and any attachments, contains information which may be confidential and privileged. Unless you are the intended recipient (or authorized to receive this message for the intended recipient), you may not use, copy, disseminate or disclose to anyone the message or any information contained in the message. Any opinions or views expressed which are of a personal nature are not necessarily those of the company. The company reserves the right to monitor all e-mail communications.

#############################################################
This message is sent to you because you are subscribed to
 the mailing list <[email protected]>.
To unsubscribe, E-mail to: <[email protected]>
To switch to the DIGEST mode, E-mail to <[email protected]>
To switch to the INDEX mode, E-mail to <[email protected]>
Send administrative queries to  <[email protected]>


#############################################################
This message is sent to you because you are subscribed to
 the mailing list <[email protected]>.
To unsubscribe, E-mail to: <[email protected]>
To switch to the DIGEST mode, E-mail to <[email protected]>
To switch to the INDEX mode, E-mail to <[email protected]>
Send administrative queries to  <[email protected]>

Reply via email to