How to fix Microsoft 365 outbound emails landing in junk or spam — SPF, DKIM, DMARC and domain reputation guide

How to Fix Microsoft 365 Outbound Emails Landing in Junk or Spam

📄 Article

How to Fix Microsoft 365 Outbound Emails Landing in Junk or Spam

📌 Important Note on PowerShell Cmdlets

This guide uses only live and active Exchange Online PowerShell cmdlets, including Get-MessageTraceV2 and Get-MessageTraceDetailV2 for message trace operations. Deprecated Get-MessageTrace examples have been removed.

Users reported that outbound emails sent from Microsoft 365 were either not being delivered consistently or were landing in recipients’ junk or spam folders instead of the inbox. In Exchange Online, this issue is commonly caused by sender authentication failures, DNS misalignment, outbound spam controls, or poor domain reputation.

The issue was resolved by reviewing Exchange Online outbound policies, validating DNS authentication records at the authoritative DNS provider, and correcting sender reputation issues such as domain blocklist status.

🔍 The Symptoms

⚠️ Observed Indicators

  • Outbound emails were not delivered reliably
  • Emails sent from Microsoft 365 landed in the recipient’s junk or spam folder
  • Recipient mail systems classified legitimate emails as spam
  • Sender authentication and reputation checks affected delivery
spf=fail
dkim=fail
dmarc=fail
compauth=fail
SCL: 5 or higher

🧠 Root Cause

Outbound email deliverability issues in Microsoft 365 usually occur when sender authentication, DNS records, outbound mail hygiene, or domain reputation signals are not aligned.

  • SPF record is missing, incorrect, duplicated, or exceeds DNS lookup limits
  • DKIM is not enabled, or required CNAME records are missing at the authoritative DNS provider
  • DMARC is missing or not aligned with SPF and DKIM
  • The sending domain has poor reputation
  • Outbound spam policies are not configured to detect suspicious outbound sending
  • DNS records are documented in Microsoft 365 but not correctly published at the authoritative DNS provider
  • The sending domain appears on a domain blocklist such as Spamhaus DBL

⚠️ Important — Spamhaus DBL

Spamhaus DBL is a domain blocklist. Administrators typically do not allow-list a domain with Spamhaus DBL. The correct action is to check whether the domain is listed, fix the underlying cause, and request delisting through the official Spamhaus process if appropriate.

🛠️ Step-by-Step Resolution

1

Review Message Trace in Exchange Admin Center

Confirm whether emails were delivered, deferred, rejected, filtered, or accepted by the recipient system but later classified as junk.

GUI Method

  1. Go to the Exchange admin center
  2. Navigate to Mail flow → Message trace
  3. Search using sender address, recipient address, date range, and subject
  4. Review the delivery status
  5. Open the message trace details and check whether the message was delivered, failed, pending, expanded, filtered as spam, or rejected by the recipient system

PowerShell Method

PowerShell — Basic Message Trace

Connect-ExchangeOnline -UserPrincipalName admin@yourdomain.com

Get-MessageTraceV2 `
    -SenderAddress   sender@yourdomain.com `
    -StartDate       "2026-08-09" `
    -EndDate         "2026-08-10" |
Select-Object Received, SenderAddress, RecipientAddress, Subject, Status, MessageTraceId
PowerShell — Detailed Trace per Message

Connect-ExchangeOnline -UserPrincipalName admin@yourdomain.com

$Trace = Get-MessageTraceV2 `
    -SenderAddress    sender@yourdomain.com `
    -RecipientAddress recipient@externaldomain.com `
    -StartDate        "2026-08-09" `
    -EndDate          "2026-08-10"

$Trace | ForEach-Object {
    Get-MessageTraceDetailV2 `
        -MessageTraceId   $_.MessageTraceId `
        -RecipientAddress $_.RecipientAddress
}
2

Review the Outbound Spam Filter Policy

The outbound spam filter policy controls how Microsoft 365 handles suspicious outbound messages. Weak outbound controls can damage domain reputation over time.

GUI Method

  1. Go to the Microsoft Defender portal
  2. Navigate to Email & collaboration → Policies & rules
  3. Select Threat policies
  4. Open Anti-spam policies
  5. Review the Outbound spam filter policy
  6. Confirm that outbound recipient limits are configured appropriately
  7. Confirm that suspicious outbound sending triggers administrative alerts

PowerShell Method

PowerShell — Review Outbound Spam Filter Policy

Connect-ExchangeOnline -UserPrincipalName admin@yourdomain.com

Get-HostedOutboundSpamFilterPolicy |
Format-List Name,
            RecipientLimitExternalPerHour,
            RecipientLimitInternalPerHour,
            RecipientLimitPerDay,
            ActionWhenThresholdReached,
            NotifyOutboundSpam,
            NotifyOutboundSpamRecipients
PowerShell — Review Outbound Spam Filter Rules

Connect-ExchangeOnline -UserPrincipalName admin@yourdomain.com

Get-HostedOutboundSpamFilterRule |
Format-Table Name, State, Priority, HostedOutboundSpamFilterPolicy, SentTo, From, SenderDomainIs -AutoSize
PowerShell — Enable Outbound Spam Notifications

Connect-ExchangeOnline -UserPrincipalName admin@yourdomain.com

Set-HostedOutboundSpamFilterPolicy `
    -Identity                     OutboundPolicyName `
    -NotifyOutboundSpam           $true `
    -NotifyOutboundSpamRecipients securityteam@yourdomain.com
3

Validate the SPF Record

SPF confirms which mail servers are authorised to send email for your domain. For Microsoft 365, the SPF record must include Exchange Online Protection.

✅ Recommended SPF Record

v=spf1 include:spf.protection.outlook.com -all

💡 Third-Party Senders

If CRM, ERP, marketing tools, ticketing systems, website applications, or notification platforms send email as your domain, they must be included in the SPF design. Do not create multiple SPF TXT records for the same domain.

PowerShell — DNS SPF Check

Resolve-DnsName -Name yourdomain.com -Type TXT |
Where-Object {
    $_.Strings -match "v=spf1"
} |
Select-Object Name, Type, Strings
SPF Check Expected Result
SPF record exists One SPF TXT record only
Microsoft 365 is included include:spf.protection.outlook.com
Multiple SPF records Not present
DNS lookup count Within the SPF lookup limit (max 10)
Alignment Envelope sender domain aligns with the sending domain strategy
4

Enable and Validate DKIM

DKIM digitally signs outbound messages so receiving systems can verify that messages were authorised by your domain and were not altered in transit.

GUI Method

  1. Go to the Microsoft Defender portal
  2. Navigate to Email & collaboration → Policies & rules
  3. Select Threat policies
  4. Open Email authentication settings
  5. Select DKIM
  6. Choose the accepted domain
  7. Enable DKIM signing
  8. If prompted, create the required CNAME records at the authoritative DNS provider

PowerShell Method

PowerShell — Check DKIM Status

Connect-ExchangeOnline -UserPrincipalName admin@yourdomain.com

Get-DkimSigningConfig -Identity yourdomain.com |
Format-List Domain, Enabled, Status, Selector1CNAME, Selector2CNAME
PowerShell — Create DKIM Config (get CNAME values)

Connect-ExchangeOnline -UserPrincipalName admin@yourdomain.com

# Create DKIM config to obtain the CNAME records to publish at DNS
New-DkimSigningConfig -DomainName yourdomain.com -Enabled $false

Get-DkimSigningConfig -Identity yourdomain.com |
Format-List Domain, Enabled, Selector1CNAME, Selector2CNAME
PowerShell — Enable DKIM Signing

Connect-ExchangeOnline -UserPrincipalName admin@yourdomain.com

Set-DkimSigningConfig -Identity yourdomain.com -Enabled $true

Get-DkimSigningConfig -Identity yourdomain.com |
Format-List Domain, Enabled, Status
5

Configure DMARC

DMARC helps recipient systems decide what to do when SPF or DKIM authentication fails. It also improves domain reputation and provides visibility into spoofing activity.

✅ Recommended DMARC Records

_dmarc.yourdomain.com TXT “v=DMARC1; p=none; rua=mailto:dmarc-reports@yourdomain.com; pct=100”
_dmarc.yourdomain.com TXT “v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@yourdomain.com; pct=100”
_dmarc.yourdomain.com TXT “v=DMARC1; p=reject; rua=mailto:dmarc-reports@yourdomain.com; pct=100”

PowerShell — Check DMARC Record

Resolve-DnsName -Name _dmarc.yourdomain.com -Type TXT |
Select-Object Name, Type, Strings
Stage Policy Purpose
Monitor p=none Collect reports and identify legitimate senders
Enforce partially p=quarantine Send failing messages to spam or quarantine
Enforce fully p=reject Reject unauthenticated messages
6

Align DNS Records with the Authoritative DNS Provider

DNS records must be correctly published at the authoritative DNS provider — not just documented in Microsoft 365 — so they are consistently resolvable by external recipient systems.

Record Type Purpose Example
MX MX Routes inbound mail to Microsoft 365 <tenant>.mail.protection.outlook.com
SPF TXT Authorises outbound senders v=spf1 include:spf.protection.outlook.com -all
DKIM CNAME Enables outbound message signing selector1._domainkey and selector2._domainkey
DMARC TXT Defines authentication policy _dmarc.<yourdomain.com>
PowerShell — Validate All DNS Records

# Verify MX record
Resolve-DnsName -Name yourdomain.com -Type MX

# Verify SPF record
Resolve-DnsName -Name yourdomain.com -Type TXT

# Verify DKIM CNAME records
Resolve-DnsName -Name selector1._domainkey.yourdomain.com -Type CNAME
Resolve-DnsName -Name selector2._domainkey.yourdomain.com -Type CNAME

# Verify DMARC record
Resolve-DnsName -Name _dmarc.yourdomain.com -Type TXT
7

Check Domain Reputation and Spamhaus DBL Status

Spamhaus DBL is used by many receiving systems to evaluate domain reputation. If the sending domain appears in DBL, recipient systems may place messages in junk or reject them.

  1. Check whether the sending domain is listed in Spamhaus DBL at check.spamhaus.org
  2. If listed, review the reason for the listing
  3. Correct the underlying issue — compromised mailbox activity, suspicious links, abusive campaign behaviour, or poor third-party sender hygiene
  4. Submit a delisting request through the official Spamhaus process if appropriate
  5. Re-test outbound delivery after DNS and reputation changes are applied

⚠️ Do Not Rely on Delisting Alone

If SPF, DKIM, DMARC, sending behaviour, or compromised accounts are not corrected, the domain may be listed again after delisting.

8

Review Compromised or High-Risk Sending Patterns

Before concluding that the issue is only DNS-related, check whether any mailbox, application, connector, or third-party sender is generating suspicious outbound mail.

PowerShell — Review Sending Volume by Recipient

Connect-ExchangeOnline -UserPrincipalName admin@yourdomain.com

Get-MessageTraceV2 `
    -SenderAddress sender@yourdomain.com `
    -StartDate     "2026-08-09" `
    -EndDate       "2026-08-10" |
Group-Object RecipientAddress |
Sort-Object Count -Descending |
Select-Object Count, Name
PowerShell — Review Transport Rules

Connect-ExchangeOnline -UserPrincipalName admin@yourdomain.com

Get-TransportRule |
Select-Object Name, State, Mode, Priority |
Format-Table -AutoSize
PowerShell — Review Outbound Connectors

Connect-ExchangeOnline -UserPrincipalName admin@yourdomain.com

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

Validate Final Mail Flow

After DNS propagation and policy updates are completed, send test messages to external recipients and validate the message headers.

Validation Item Expected Result
Message delivery ✅ Recipient receives the message
Inbox placement ✅ Message lands in inbox, not junk
SPF ✅ Pass
DKIM ✅ Pass
DMARC ✅ Pass or aligned
SCL ✅ Low spam confidence level
Domain reputation ✅ Not blocklisted
Message trace ✅ Delivered without suspicious filtering events
PowerShell — Validate Final Delivery

Connect-ExchangeOnline -UserPrincipalName admin@yourdomain.com

Get-MessageTraceV2 `
    -SenderAddress    sender@yourdomain.com `
    -RecipientAddress recipient@externaldomain.com `
    -StartDate        "2026-08-10" `
    -EndDate          "2026-08-11" |
Select-Object Received, SenderAddress, RecipientAddress, Subject, Status, MessageTraceId
PowerShell — Full Detail Trace Validation

Connect-ExchangeOnline -UserPrincipalName admin@yourdomain.com

$Trace = Get-MessageTraceV2 `
    -SenderAddress    sender@yourdomain.com `
    -RecipientAddress recipient@externaldomain.com `
    -StartDate        "2026-08-10" `
    -EndDate          "2026-08-11"

$Trace | ForEach-Object {
    Get-MessageTraceDetailV2 `
        -MessageTraceId   $_.MessageTraceId `
        -RecipientAddress $_.RecipientAddress
}

✅ Current Status

✅ Resolution Outcome

After reviewing the outbound spam filter policy, aligning DNS configuration, validating SPF, DKIM, and DMARC, and addressing sender reputation issues, outbound email delivery normalised.

  • Outbound emails were delivered successfully
  • Messages started landing in recipients’ inboxes
  • Legitimate messages were no longer incorrectly classified as junk
  • Sender reputation improved after DNS and domain reputation issues were addressed

💡 Best Practices & Recommendations

  • Use SPF, DKIM, and DMARC together. SPF alone is not enough for strong email authentication
  • Manage DNS records at the authoritative DNS provider, not only in the Microsoft 365 admin center
  • Monitor outbound sending behaviour to detect compromised accounts, risky applications, or abnormal sending patterns
  • Use least-privilege admin roles such as Exchange Administrator or Security Administrator instead of Global Administrator for routine mail flow changes
  • Review third-party senders regularly. CRM, ERP, ticketing, marketing, and website platforms must be included in the SPF, DKIM, and DMARC strategy if they send as your domain
  • Do not rely on blocklist delisting alone. Always fix the technical cause before requesting delisting from any reputation provider

📝 Conclusion

💡 Key Takeaway

The Microsoft 365 outbound email delivery issue was resolved through a combination of Exchange Online outbound policy review, DNS authentication alignment, and sender reputation remediation.

The key fix was ensuring that SPF, DKIM, and DMARC were correctly configured at the authoritative DNS provider and that domain reputation issues were addressed. After DNS propagation and validation were completed, outbound emails began landing successfully in recipients’ inboxes instead of being incorrectly marked as junk.

📚 References & Further Reading

Explore More Exchange Online Resources

Continue learning with our complete Exchange Online administration guide, course modules, and interview preparation resources.

Leave a Comment

Your email address will not be published. Required fields are marked *