When a user reports that an expected email never arrived—or an outbound message bounced silently—Message Trace in Exchange Online is the fastest way to pinpoint where the message went.
Legacy Office 365 guides relied on Get-MessageTrace (which had a strict 10-day window and older pagination behavior). Today, Microsoft provides Get-MessageTraceV2 (up to 90 days of real-time queryable trace data in ExchangeOnlineManagement v3.7+) alongside Extended Message Trace (Start-HistoricalSearch) for deep routing, transport rule, and connector diagnostics.
Exchange Online Message Trace Workflow
Step 1: Connect to Exchange Online PowerShell
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline -ShowBanner:$false
Step 2: Track Emails Between a Sender and Recipient
Query the last 48 hours (or up to 90 days with Get-MessageTraceV2) and format the delivery status:
$StartDate = (Get-Date).AddDays(-7)
$EndDate = Get-Date
$Messages = Get-MessageTraceV2 `
-SenderAddress "[email protected]" `
-RecipientAddress "[email protected]" `
-StartDate $StartDate `
-EndDate $EndDate
$Messages | Select-Object Received, SenderAddress, RecipientAddress, Subject, Status, FromIP, ToIP |
Format-Table -AutoSize
Step 3: Inspect Detailed Delivery & Bounce Events
If a message shows Failed, Quarantined, or Pending, pipe its MessageTraceId and RecipientAddress into Get-MessageTraceDetailV2 to see the exact SMTP error or Transport Rule that acted on it:
foreach ($Msg in $Messages) {
Write-Host "`n--- Trace Details for: $($Msg.Subject) ($($Msg.Status)) ---" -ForegroundColor Cyan
Get-MessageTraceDetailV2 -MessageTraceId $Msg.MessageTraceId -RecipientAddress $Msg.RecipientAddress |
Select-Object Date, Event, Action, Detail |
Format-Table -Wrap -AutoSize
}
Step 4: Run an Extended Message Trace (Start-HistoricalSearch)
When you need full TLS cipher details, connector names, or SPF/DKIM/DMARC evaluation headers for an incident report, queue an asynchronous Extended Message Trace:
Start-HistoricalSearch `
-ReportTitle "Incident-Trace-$(Get-Date -Format 'yyyyMMdd')" `
-StartDate (Get-Date).AddDays(-14) `
-EndDate (Get-Date) `
-ReportType MessageTraceEx `
-SenderAddress "[email protected]" `
-NotifyAddress "[email protected]"
Check job progress with Get-HistoricalSearch and download the CSV directly from the Exchange Admin Center (Mail flow > Message trace > Downloadable reports).
💬 Reader Comments & Feedback
Did this runbook help, or did Microsoft change a cmdlet or UI menu? Share your feedback below.
Leave a Comment or Report an Update