[英]How to get notification of exchange email queue
i want to get the notification of full details of get-queue when my exchange queue reaches maximum message count , here is what i have now which give you the details but not in correct format. 当我的交换队列达到最大邮件数时,我想获取有关get-queue的完整详细信息的通知,这是我现在拥有的内容,它为您提供详细信息,但格式不正确。
function check_queue
{
$a = get-queue | measure-object MessageCount -max
$b = Get-Queue | Out-File -filepath C:\getQueue.txt
if ($a.Maximum -gt 1000)
{
send_email $a.Maximum
}
}
function send_email
{param ($queue_size)
$emailFrom = "exchange@xyz.com"
$emailTo = "test@xyz.com"
$subject = "Exchange Max Mail QUEUE"
$body = Get-Queue | Out-String
$smtpServer = "mail.xyz.com"
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($emailFrom, $emailTo, $subject, $body)
}
check_queue
here is the output which is not clear in the format when i get the notification:- 这是我收到通知时格式不清楚的输出:-
Identi DeliveryType Status MessageCount Velocity RiskLevel OutboundIPPool NextH
ty opDom
ain
------ ------------ ------ ------------ -------- --------- -------------- -----
xy... SmtpDeliv... Ready 0 0 Normal 0 ma...
xy... SmtpDeliv... Ready 0 0 Normal 0 ma...
xy... SmtpDeliv... Ready 0 0 Normal 0 ma...
xy... SmtpDeliv... Ready 0 0 Normal 0 ma...
xy... SmtpRelay... Ready 0 0 Normal 0 ed...
xy... Undefined Ready 0 0 Normal 0 Su...
xy... ShadowRed... Ready 20 0 Normal 0 gr...
If you want to have all details of the object in your output file, you might use the format cmdlets. 如果要在输出文件中包含对象的所有详细信息,则可以使用cmdlet格式。 eg format-custom, format-list
$body = get-queue | format-list | out-string
例如format-custom,format-list
$body = get-queue | format-list | out-string
$body = get-queue | format-list | out-string
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.