Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have had issues with compromised Exchange accounts sending a large amount of unsolicited e-mails out. We have mitigated this by using a cloud e-mail gateway that does a better job in detecting these outgoing messages as to not hurt our e-mail reputation.

However, we would still like to detect any abnormal e-mail activities. One idea is a report of the Exchange accounts with the most outgoing message.

Any idea on how to do this? Or a similar stat that may be indicative of an account being compromised?

share|improve this question
You want just smtp outbound or internal top "talkers" too? And, is your email gateway the ONLY way out for your email for sure or just your Exchange smart host? – TheCleaner Jun 1 '14 at 18:32
Correct. The cloud gateway is the Exchange smarthost. Since we are focusing on compromised authenticated Exchange accounts, the Exchange stats should suffice for our use-case. – Belmin Fernandez Jun 1 '14 at 22:37
Which 3rd party gateway? They should have their own reporting tools that would be better, since it would only focus on external email. I can offer some Exchange specific suggestions if not. – TheCleaner Jun 2 '14 at 2:33
We are now using EOP but, since we are not stuck on that, we rather use a report from the on-premise Exchange. – Belmin Fernandez Jun 2 '14 at 12:50
up vote 1 down vote accepted

I came up with this PS script today which does the job:

add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010

$output = Get-TransportServer | Get-MessageTrackingLog -Start (get-date).AddDays(-1) -EventID "SEND" -ResultSize Unlimited | Group-Object -Property Sender | %{ New-Object psobject -Property @{Sender=$_.Name;Recipients=($_.Group | Measure-Object RecipientCount -Sum).Sum}} | Where-Object {$_.Recipients -gt 100} | Sort-Object -Descending Recipients | Format-Table -AutoSize Sender,Recipients | Out-String

Send-MailMessage -From -Subject "Exchange senders report: $(Get-Date -UFormat '%a, %D')" -To -Body $output -SMTP

Basically, it send us a report of everyone who has sent e-mail to more than 100 users in total in the past 24 hours.

I then made it a scheduled daily task. This seems to do the trick.

share|improve this answer
Look at this one that I found a while back mate...sorry for the delays. If it works for you (modified of course for your need) then feel free to edit your answer and accept your… – TheCleaner Jun 2 '14 at 18:07
Oh thanks! I was trying to keep it as simple as possible but that one certainly gives me ideas. – Belmin Fernandez Jun 3 '14 at 11:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.