技術文章 · IT 指令工具箱

Exchange Online 郵件追蹤:Get-MessageTraceV2、Connector 與垃圾郵件排錯

Microsoft 365 郵件沒收到怎麼查?整理 Get-MessageTraceV2、詳細事件、Transport Rule、Connector、Quarantine、SPF/DKIM/DMARC 與 SMTP AUTH。

作者 Steve Chen · 發布  · 約 10 分鐘閱讀

IT 指令工具箱 — 廷皓技術專欄插圖

郵件沒收到先拿寄件者、收件者、精確時間、主旨片段與 Message-ID,再查 trace。只有截圖『寄件成功』不夠,寄件端接受不代表最後已投遞。

19 組範例Exchange OnlineExchangeOnlineManagement current release查核日期:2026-08-11
動手前:重送、release quarantine、改 transport rule 或 connector 都會影響真實郵件。先用 trace 與 header 查明原因;搜尋結果與隔離內容含敏感郵件資料。

Message Trace V2

查最近 24 小時Exchange Online PowerShell

Get-MessageTraceV2 -StartDate (Get-Date).AddHours(-24) -EndDate (Get-Date) -ResultSize 5000

時區與查詢期間要記錄,避免漏跨日。

依寄件者查Exchange Online PowerShell

Get-MessageTraceV2 -StartDate (Get-Date).AddDays(-2) -EndDate (Get-Date) -SenderAddress [email protected]

外部寄件者拼字與 envelope sender 可能不同。

依收件者查Exchange Online PowerShell

Get-MessageTraceV2 -StartDate (Get-Date).AddDays(-2) -EndDate (Get-Date) -RecipientAddress [email protected]

群組展開後可能要查實際成員。

依 Message-ID 查Exchange Online PowerShell

Get-MessageTraceV2 -StartDate (Get-Date).AddDays(-2) -EndDate (Get-Date) -MessageId '<[email protected]>'

Message-ID 從原始 header 取得,通常包含角括號。

取單封 trace 詳細事件Exchange Online PowerShell

$t=Get-MessageTraceV2 -StartDate (Get-Date).AddDays(-2) -EndDate (Get-Date) -RecipientAddress [email protected] | Select-Object -First 1; Get-MessageTraceDetailV2 -MessageTraceId $t.MessageTraceId -RecipientAddress $t.RecipientAddress

先確認 $t 真的是目標郵件,不要只拿第一筆正式判斷。

匯出 traceExchange Online PowerShell

Get-MessageTraceV2 -StartDate (Get-Date).AddHours(-24) -EndDate (Get-Date) -ResultSize 5000 | Export-Csv .\message-trace.csv -NoTypeInformation -Encoding utf8

CSV 含郵件地址與主旨,需限制存取。

Rule、Connector 與隔離

查看啟用中的 Transport RulesExchange Online PowerShell

Get-TransportRule | Where-Object State -eq 'Enabled' | Sort-Object Priority | Format-List Name,Priority,Mode,StopRuleProcessing,Description

找 redirect、reject、quarantine、header 與 stop processing。

查看 Inbound ConnectorExchange Online PowerShell

Get-InboundConnector | Format-List Name,Enabled,SenderDomains,SenderIPAddresses,RequireTls,TlsSenderCertificateName

來源 IP 或憑證名稱漂移會讓 connector 不命中。

查看 Outbound ConnectorExchange Online PowerShell

Get-OutboundConnector | Format-List Name,Enabled,RecipientDomains,SmartHosts,TlsSettings,RouteAllMessagesViaOnPremises

smart host、TLS 與 scoped connector 要一起看。

連到 Security & CompliancePowerShell

Connect-IPPSSession

需要對應權限與 ExchangeOnlineManagement 模組。

查最近隔離郵件Security & Compliance PowerShell

Get-QuarantineMessage -StartReceivedDate (Get-Date).AddDays(-2) -EndReceivedDate (Get-Date)

不要未檢查內容與威脅判定就直接 release。

查看反垃圾信政策Exchange Online PowerShell

Get-HostedContentFilterPolicy | Format-List Name,SpamAction,HighConfidenceSpamAction,PhishSpamAction,BulkThreshold

還要確認 policy rule 套到哪些人。

查看出站垃圾信政策Exchange Online PowerShell

Get-HostedOutboundSpamFilterPolicy | Format-List Name,RecipientLimitExternalPerHour,RecipientLimitInternalPerHour,ActionWhenThresholdReached,AutoForwardingMode

租戶限制與 service limit 仍可能另外套用。

Domain、DKIM 與 SMTP AUTH

查看 Accepted Domain 類型Exchange Online PowerShell

Get-AcceptedDomain | Format-Table DomainName,DomainType,Default

InternalRelay 沒 connector 可能造成未知收件者無法轉送。

查看 DKIM 狀態Exchange Online PowerShell

Get-DkimSigningConfig | Format-Table Domain,Enabled,Status,Selector1CNAME,Selector2CNAME

CNAME 發布與 Enabled 都要確認。

查看全租戶 SMTP AUTHExchange Online PowerShell

Get-TransportConfig | Format-List SmtpClientAuthenticationDisabled

True 表示全租戶預設停用。

查看單一 Mailbox SMTP AUTHExchange Online PowerShell

Get-CASMailbox [email protected] | Format-List SmtpClientAuthenticationDisabled

Null 表示跟隨組織設定。

查 MXPowerShell

Resolve-DnsName contoso.com -Type MX

確認 MX 指向預期 Microsoft 365 或第三方防護服務。

查 SPF 與 DMARCPowerShell

Resolve-DnsName contoso.com -Type TXT; Resolve-DnsName _dmarc.contoso.com -Type TXT

檢查來源是否授權與 alignment。

怎麼確認有做對

  • trace 的 Receive、Rule、Spam、Deliver/Fail 事件能串成完整路徑。
  • Connector、Accepted Domain、MX 與 TLS 設定和實際拓樸一致。
  • 用可辨識主旨與 Message-ID 的測試信驗證修正,並查最終 header。

常見錯誤

  • 只查收件匣,不查 Junk、Quarantine、Rule 與 forwarding。
  • 查錯時區或時間範圍。
  • 看到 Delivered 就認為一定顯示在 Outlook 收件匣。
  • 為了一封信直接停用整條防垃圾信政策。

常見問題

Trace 顯示 Delivered,使用者為什麼看不到?

Delivered 代表送到 mailbox,不保證在 Inbox。接著查 Junk、Inbox Rule、Sweep、Focused Inbox、delegate、retention、client sync 與搜尋條件。

舊 Get-MessageTrace 還能用嗎?

以當期 ExchangeOnlineManagement 和 Microsoft 公告為準;新內容優先使用 Get-MessageTraceV2/Get-MessageTraceDetailV2,避免照過期參數。

延伸閱讀

版本與官方文件

參數會隨工具版本與作業系統實作改變。正式環境先用 --help、-h 或系統內建說明確認,再以當版官方文件為準。

常見問題

Trace 顯示 Delivered,使用者為什麼看不到?

Delivered 代表送到 mailbox,不保證在 Inbox。接著查 Junk、Inbox Rule、Sweep、Focused Inbox、delegate、retention、client sync 與搜尋條件。

舊 Get-MessageTrace 還能用嗎?

以當期 ExchangeOnlineManagement 和 Microsoft 公告為準;新內容優先使用 Get-MessageTraceV2/Get-MessageTraceDetailV2,避免照過期參數。

聯絡廷皓討論 看更多文章