Sharepoint Online Sharing Emails – Rejected / Bounced / NDR

If you have a 3rd party mail security system, or you have locked down Office 365 inbound mail flow, you may notice that when you attempt to share something with an internal colleague in SharePoint Online, the sharing invitation NDRs and gets bounced back. If your mail goes direct to Office 365 and you have configured an Inbound Connector in order to lock down inbound mail (eg to only allow Mimecast to send mail to Office 365), you may see the following error:

Your message wasn't delivered because the recipient's email provider rejected it.

Alternatively, your 3rd party mail hygeine product (in my case, Mimecast) blocked the message before it could get to Office 365 with a slightly different error:

Remote Server returned '< #5.5.0 smtp;550 Administrative Lockout - Inbound not allowed >'

The reason for this error is because the SharePoint Online service is spoofing your email address to send the sharing invitation. If we look more closely at the source server name, we can see that, in my example, the email came from DB4.MAIL.YLO001.MSOPRD.MSFT.NET, which is one of Microsofts own SMTP servers (probably running MDaemon ;-D). The email is coming from a Microsoft SMTP server and is using one of your own email addresses. Not many email services will like this, particularly mail security services such as Mimecast or MessageLabs if this is where your MX records point. To get around this, you will need to allow the SharePoint Online IP address ranges to send using your domain name.

If your MX records point to Office 365 and you have an Inbound Connector configured for locking down inbound mail flow, then you can connect to Exchange Online Powershell and add the SharePoint Online IP addresses to your connector:

First, run Get-InboundConnector | fl and note down the existing SenderIPAddresses. In this example, I will use for demonstration purposes.

Then run the below command to change the IP addresses assigned to the connector. Make sure you include the IP addresses of the mail system which your MX records point to, or you will end up not receiving any mail at all!

Set-InboundConnector -Identity "Connector Name" -SenderIPAddresses,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

The list of IP addresses above is all of the SharePoint Online IPs at the time of writing, however this is subject to change and should be checked by yourself prior to running this command. You can check the list of IP addresses here:

In my case the problem was actually with my Mimecast configuration, not Office 365. In Mimecast there is an Inbound Lockout Policy section under Gateway>Policies. The policies configured here say that any Inbound messages from our domain name should be dropped by the firewall. This stops spoofing and is a default policy. To stop Mimecast blocking messages from SharePoint Online, I created a new Inbound Lockout Policy which did not block emails to my domain name when the Sender IP address was one of SharePoint Online’s IPs. This rectified the problem.

Locking down mail flow does have many benefits, but simplified administration is not one of them unfortunately!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s