news and infos about microsoft, technology, cloud and more

Hop count exceeded–how to resolve a possible mail loop in Office 365

In this blogpost I will describe a solution for IT Administrators with the following situation:
You are unable to receive E-Mails in your Office 365 account, senders receive a NDR (non delivery report).
The NDR says:

The following organization rejected your message:

Diagnostic information for administrators:

Generating server: #< #5.4.6 smtp;554 5.4.6 Hop count exceeded - possible mail loop> #SMTP#

…this can be caused by a duplicate entry in FOPE!

To get this situation resolved you don’t need a support call with Microsoft. You can solve it with a little PowerShell magic.

First take a look in your Exchange Online Management Board where you can access the FOPE portal (if you are on an E-Plan) .
Simply click on Exchange Online / Mail control / Forefront Online Protection for Exchange.


Check if you see a duplicate entry within the Domain section in FOPE!


If that’s the case you can set the entry with PowerShell.
As I am aware that PowerShell is not everyone's most loved tool, here are all commands you have to run within PowerShell, so you can make your life easier with simply copy & paste from here.

$LiveCred = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $LiveCred -Authentication Basic –AllowRedirection

Import-PSSession $Session –AllowClobber

Set-AcceptedDomain -Identity -OutboundOnly $true

Set-AcceptedDomain -Identity -OutboundOnly $false

After that, wait for approximately one hour. Check your FOPE entries. All should be set to normal and mail-flow starts working again!

Attention: use this only if you are in the above mail loop situation. Smiley

Hope that helps!

Martina Grom, MVP Office 365.
Follow me on Twitter