Back to blog

Export mail traffic statistics from Office 365

Jun 19, 2013 by Dan Rose

Microsoft have recently released a number of new cmdlets that are available to tenants that have previously been upgraded to Wave 15. A few of these are outlined in one of our previous blogs.

The one I want to focus on in this article is the Get-MailTrafficReport cmdlet which is used to view mail traffic information in your organisation.

Of course the easiest way to view what Office 365 mail traffic is coming through your organisation is to utilise our advanced Office 365 reporting software.

In another blog post we also show you how to find out how many emails each user sent and received.

Anyway, before you can run this cmdlet, as I said earlier, you need to make sure that your tenant is running version 15 or greater. If you’re unsure of the version you are running then this article will guide you in the right direction.

Just running the cmdlet without any parameters will return a bunch of statistics which you can work with, but the beauty of this command is that you can use the built-in parameters to summarise and collate all the data into a more readable format. Some of these are outlined below.

-AggregatedBy <string>  Use this parameter to specify the time period by which the output will be summarised. The allowed values are Hour, Day & Summary

-SummarizedBy <MultiValuedProperty> Specify the properties that you would like your output total based on. For example, Using the EventType value will group the data into a single count.

-StartDate & -EndDate <date> in the format of mm/dd/yyyy

-Direction <MultiValuedProperty> can either be Inbound or Outbound

-EventType <MultiValuedProperty> this is a predefined value, a complete list can be found by typing this command into the Powershell console.

Get-MailFilterListReport -SelectionTarget EventTypes


Outbound message counts by hour for a specific day
Get-MailTrafficReport -AggregateBy hour -StartDate 06/11/2013 -EndDate 06/12/2013 EventType goodmail -Direction outbound | select date,messagecount
Screen Shot 2013-06-12 at 21.58.20
Inbound message counts by EventType for a specific time period
Get-MailTrafficReport -Direction Inbound -StartDate 06/02/2013 -EndDate 06/09/2013 | format-table Date,EventType,MessageCount
Screen Shot 2013-06-12 at 22.12.25

Inbound message counts Summarised by EventType
Get-MailTrafficReport -StartDate 05/31/2013 -EndDate 06/06/2013 -Direction inbound -SummarizeBy EventType | Select Date,MessageCount
Screen Shot 2013-06-13 at 14.40.04