Hi @Ornaldo
I found this similar script but it is not the same scenario as the one i'm trying.
This script would export not only the emails sent to external but also the emails sent to internal.
I suppose this is the point.
I have modified the script to filter only the external emails, please check if it can meet your need.
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
$output = Get-TransportServer | Get-MessageTrackingLog -Start (get-date).AddDays(-1) -ResultSize Unlimited | where{$_.EventId -eq "SEND" -or $_.EventId -eq "SENDEXTERNAL" -and $_.Recipients -notlike "*@contoso.com*"}
$result = $output | Group-Object -Property Sender
$report = $result | %{ 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 admin@contoso.com -Subject "Exchange senders report: $(Get-Date -UFormat '%a, %D')" -To report@contoso.com -Body $report -SMTPserver smtp.contoso.com
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.