We help IT Professionals succeed at work.

Exchange Online: Daily total count of in- and outbound mails being send by organization

Medium Priority
36 Views
Last Modified: 2020-03-25
Hi,

We are currently using Office 365 E5 licenses and would like to recieve daily automated reports regarding our total send and received mails from our organization.

We tried varied scripts and read forum topics but it isn't exactly what we are looking for or are outdated PowerShell queries and third party tools which isn't a solution for our company.

We would like to receive the same statistics being used by the Microsoft Adminportal called Reports Usage for email activity. Unfortunately it is only possible to view the past 7, 30, 90 and 180 days and therefore isn't what we need.

For now we don't need statistics on user level but only organization wide. Furthermore we would like to have daily insights regarding send (outbound) and received (inbound) mails.

Admindroid isn't an option for us and also tried a script (https://gallery.technet.microsoft.com/office/Office-365-Mail-Traffic-afa37da1) but within a days range it doesn't collect the data well.

Does anyone else might have a solution regarding the above?

I would like to thank you in advance!

Kind Regards,
Comment
Watch Question

timgreen7077Exchange Engineer
CERTIFIED EXPERT
Distinguished Expert 2018

Commented:
See the below link this should be what you are looking for. It will also give you the powershell cmdlets for the results. Its a simple cmdlet you can copy and paste. If you want this daily you will need to run it day or create a task to run the cmdlets daily.

https://docs.microsoft.com/en-us/powershell/module/exchange/reporting/get-mailtrafficreport?view=exchange-ps
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2019

Commented:
The report you are referring to can be accessed via the Graph API, so just use that. It does not however actually include all sent/received messages across your company. For those numbers you can use the corresponding report in the SCC (https://protection.office.com/reportv2?id=SentAndReceivedMailATP&pivot=EventType), which you can download or schedule, or you can use a PowerShell-based solution that gathers detailed info via the Get-MessageTrace cmdlet: https://gallery.technet.microsoft.com/office/Office-365-Mail-Traffic-afa37da1
Sys @dminSystem Administrator

Author

Commented:
@timgreen7077 thanks for your reply!

When I use the below CMDlet:
Get-MailTrafficReport -StartDate 03/23/2020 -EndDate 03/23/2020 -Direction Outbound -SummarizeBy Domain,EventType | Format-Table Domain,Date,MessageCount

Open in new window


I get the following result:
Domain Date               MessageCount
------ ----               ------------
       23-3-2020 00:00:00            1

A MessageCount of 1 for the Outbound mail isn't correct or am I using the CMDlet wrong?
Sys @dminSystem Administrator

Author

Commented:
Hi @Vasil Michev thanks for your fast reply!

I already used your secundairy link (https://gallery.technet.microsoft.com/office/Office-365-Mail-Traffic-afa37da1) and this is to much information for our needs at the moment.

Correct me if I'm wrong but you are saying that -when using your primairy link (https://protection.office.com/reportv2?id=SentAndReceivedMailATP&pivot=EventType) - we get the correct data by send and received mail for each day including SPAM, Malware and Good mail types. And if we are using the Graph API from the default usage report on the Admin Dashboard we only get the send and received mail which are marked as Good mail types from the past 7, 30, 90 and 180 days?
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2019
Commented:
The default usage reports only covers user mailboxes, if that's enough for you it's OK to use it. The report in the SCC covers all recipients, not just user mailboxes.
timgreen7077Exchange Engineer
CERTIFIED EXPERT
Distinguished Expert 2018

Commented:
you need to set it for 24 hours so it would be start 3/22/2020 end 3/23/2020, or you can add the time with the date so -start 3/23/2020 12:01am -end 11:59pm
Sys @dminSystem Administrator

Author

Commented:
Hi timgreen and Vasil,

Thank you very much for your provided solutions, these will be sufficient for now!

Kind Regards,