question

ShabazAhmed-5117 avatar image
0 Votes"
ShabazAhmed-5117 asked KyleXu-MSFT commented

How to check total mails(IN and OUT) of one month in exchange server 2016

Hi all,

Can anybody suggest how to check IN and OUT mails of one month.
Example : I need to check total number of send and receive mails in our organization for the month of July for both internal and external domain.

Thanks,
Shabaz

office-exchange-server-administrationoffice-exchange-server-mailflowoffice-exchange-server-itpro
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AshokM-8240 avatar image
0 Votes"
AshokM-8240 answered

Hi,

Apart from the suggestion provided above, please try the script available in the below link which provides some additional information.

https://gallery.technet.microsoft.com/office/Total-Emails-Sent-and-c1daf5e7

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

KyleXu-MSFT avatar image
0 Votes"
KyleXu-MSFT answered KyleXu-MSFT commented

Please Note: Exchange Q&A doesn't supported for development and writing of script, if you have this requirement, I would suggest you post it in stackoverflow forum or open a ticket to Microsoft, they will could help you writing script.

We can use Message Tracking log to check and count emails. Message tracking log only records emails within 30 days, you could use command below to check the setting of it:

 Get-TransportService | fl name,MessageTrackingLogMaxAge

Then you could using those script to count the number of email:

 $From = "8/1/2020"
 $To = "8/31/2020"
    
 $intSent = 0
 $intRec = 0
    
 $Mailboxes = Get-Mailbox -ResultSize unlimited  | where {$_.RecipientTypeDetails -eq "UserMailbox"}
    
 foreach ($Mailbox in $Mailboxes){
 Get-TransportService | Get-MessageTrackingLog -Sender $Mailbox.PrimarySmtpAddress -ResultSize Unlimited -Start $From -End $To | ForEach {
     If ($_.EventId -eq "RECEIVE" -and $_.Source -eq "SMTP") {
         $intSent ++
     }
 }
    
 Get-TransportService | Get-MessageTrackingLog -Recipients $Mailbox.PrimarySmtpAddress -ResultSize Unlimited -Start $From -End $To | ForEach {
     If ($_.EventId -eq "DELIVER") {
         $intRec ++
     }
 }
 }
    
 Write-Host "`nResult:`n--------------------`n"
 Write-Host "Total Sent:"$intSent""
 Write-Host "Total Receive:"$intRec""
 Write-Host "`n--------------------`n"

If the response is helpful, please click "Accept Answer" and upvote it.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@ShabazAhmed-5117
Haven't received your update for a long time, any update about this thread now?
If the above suggestion helps, please be free to mark it as an answer for helping more people.


If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

0 Votes 0 ·