You can use a script check number of mails stuck at the queue and send you an alert if the number of mails exceeds 10 or whatever number you want
You can schedule this script to run every 15 min
#Script: GetQueueMails.ps1
#Purpose: This script collect info about the server Queue and trigeer an alert if the # number of mail in queue exceeds 10 mails it send a full report
#about mails in queue to the address mentioned below
#Author: John Yassa
# Email: John.nassan@yahoo.com
# Date: June 2012
# Notes:
# – tested with Exchange 2010 SP1 and Exchange 2010 SP2
# – The log report output file will be created under “c:\queue.txt”
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
$filename = “C:\queue.txt”
$server=get-queue
$server.messagecount
if ($server.messagecount -gt 10)
{
$server | Where-Object { $_.MessageCount -gt 10 } | Format-Table -Wrap -AutoSize | out-file -filepath C:\TEMP\qu.txt
Start-Sleep -s 10
$smtpServer= “IP of SMTP Server”
$msg = new-object Net.Mail.MailMessage
$att = new-object Net.Mail.Attachment($filename)
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$msg.From = “Mail From Address”
$msg.To.Add(“Mail To Address“)
#$msg.To.Add(“user2@domain.com“)
$msg.Subject = “HUB SERVER QUEUE THRESHOLD REACHED”
$msg.Body = “Kindly check attached queue log file for more information”
$msg.Attachments.Add($att)
$smtp.Send($msg)
}
i am trying to set up this script and the txt files are not being created nor is the email can you loan any advice
Can you send me the error you are seeing