Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

550 5.7.64 TenantAttribution; Relay Access Denied: an application server can't relay through Microsoft 365

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

This error means Microsoft 365 received mail from your server but could not match it to your tenant, so it refused to relay it. Microsoft's page on printers, scanners and line-of-business applications names a change of your static public IP address, or of the certificate your application or device presents, as a common cause. A server or hosting move can change both at once.

The repair is in the inbound connector in the Exchange admin center: make its IP address or certificate domain match what the server now presents. A second documented cause is a server that does not send its full certificate chain.

What the error means

When an application, a scanner or a mail server sends through Microsoft 365 without signing in to a mailbox, Microsoft calls it SMTP relay. Microsoft's setup page says an inbound connector "authenticates your device or application using a TLS certificate (recommended) or public IP address." Mail that matches the connector is treated as belonging to your organisation.

If nothing matches, the sender gets the NDR. Microsoft's page for senders shows the error text as 550 5.7.64 TenantAttribution; Relay Access Denied SMTP, and says senders see it in a non-delivery report, in IIS SMTP logs or in Send connector logs. The printers and applications page lists a sibling error, 4.4.62 Mail sent to the wrong Office 365 region, with the advice: "A common cause of this issue is a change in your dedicated and static IP address or a change in the certificate used by your application or device. Update the inbound connector with the new IP address or new certificate information."

Scope: the documented scenario is relaying "from your on-premises Exchange environment or from your Internet Information Services (IIS) SMTP server" with "an inbound connector that's set to on-premises and has certificate validation enabled."

Likely causes

Cause What you see How to confirm
Public IP address changed (server, firewall or provider moved) and the connector is IP-based Relay worked before the move, fails after. Errors 550 5.7.64 or 4.4.62 Compare the server's current public IP with the IP listed on the inbound connector
Certificate replaced or renamed and the connector is certificate-based Same errors after a certificate renewal or a new server Compare the certificate's Subject or SAN with the domain on the connector
Server sends only its own certificate, without the intermediate CAs NDR plus CAPI2 event 30 with result 800B0109 on the sending server Event Viewer on the sending server, if CAPI2 operational logging is on
A place to look: connector missing, disabled or not of the on-premises type (Microsoft does not list this as a cause of this error) Relay never worked, or stopped when a connector was removed Connectors page in the Exchange admin center

Prove the cause before changing anything

Read first, change nothing.

  1. On the sending server, note its current public IP address and the certificate bound to the SMTP service. A hosting move or new internet circuit changes the first. A renewal or rebuild changes the second.
  2. In the Exchange admin center, open Mail flow, then Connectors. Open the inbound connector for your own mail server and note which method it uses: certificate subject name, or IP address.
  3. In Exchange Online PowerShell, list the connector settings. Microsoft's page says this displays "detailed configuration information":
Get-InboundConnector | Format-List
  1. Confirm port 25 is reachable from the sending server. Relay requires port 25, per Microsoft's setup page. Use your own MX endpoint: in the Microsoft 365 admin center, open the domain's DNS records and copy the "Points to address" from its MX record. Microsoft's example is contoso-com.mail.protection.outlook.com; replace it with your own value:
Test-NetConnection -ComputerName contoso-com.mail.protection.outlook.com -Port 25
  1. If the server runs Windows, check for the certificate-chain cause. The NDR page says that when CAPI2 operational logging is enabled, event 30 in the Microsoft-Windows-CAPI2/Operational channel records "A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider." Open that log in Event Viewer. If logging was never enabled, there is nothing to read.

Fix

Connector IP changed. The setup page says an IP-based connector needs "the public IP address used by the device or application", and that "Dynamic IP addresses aren't supported or allowed." Do not share the address with anyone outside your organisation.

Save first: copy the output of the Get-InboundConnector | Format-List command into a text file, so the old IP list is on record.

Disruptive step: edit the connector in the Exchange admin center and replace the old public IP with the new one. Impact: relay from the old address stops being accepted; Microsoft's pages do not say how long that takes (see Risks and limits). If another system still sends from the old address, its mail is refused. Back-out: edit the connector again and enter the recorded old address.

Also update your SPF record to include the new address. Microsoft says to add the IP as a message source in the SPF record, so mail is not sent to Junk Email.

Connector certificate domain changed. For certificate-based relay, the setup page requires "a certificate where the Subject or Subject Alternate Name (SAN) fields contain an accepted domain in Microsoft 365". For several hosts in one certificate it recommends the value *.contoso.com in the connector's domain box. The same pattern for a domain named contoso.com.au is *.contoso.com.au.

Save first: record the domain currently in the connector, from the saved listing above.

Disruptive step: edit the connector's domain to match the new certificate. Impact: any other server using the old certificate name is refused. Back-out: re-enter the recorded domain.

Server not sending the full chain. The NDR page's cause is that "the on-premises server is not sending the required certificate chain during the Transport Layer Security (TLS) handshake to Exchange Online." Its fix has three parts. First, "Get the list of intermediate certificates from the issuer of the third-party certificate." Second, export the intermediate certificates from the affected server: open the Certificates snap-in for the computer account, expand Personal, double-click the third-party certificate associated with the SMTP service and open the Certification Path tab. Select an intermediate certificate, click View Certificate, then Copy to File on the Detail tab. On the Export File Format page select "DER encoded binary X.509 (.CER)", and on the File to Export page choose the file name and path. Repeat for every intermediate certificate in the path. Third, import the exported files into the intermediate certification authorities store on the sending server, with the command below.

Save first: list what is already in the server's intermediate store and copy the output into a text file. Run this in an elevated PowerShell session on the sending server; Microsoft's Import-Certificate page uses Get-ChildItem on the Cert: drive to browse certificate stores:

Get-ChildItem -Path Cert:\LocalMachine\CA

Risk: the import adds certificates to the server's machine-wide intermediate store. Impact: other services on that server also trust and use the added intermediates. Back-out: after the import, run the same listing again. Delete only the certificates whose thumbprints appear in the second listing and not in the first, in the Certificates snap-in for the computer account, in the intermediate certification authorities store (the store the import command targets, cert:\LocalMachine\CA).

Then run the import from Microsoft's page, with the path of each exported file (the page's path is c:\import\intermediateca.cer; use the file name and path you chose at the export step):

Get-ChildItem -Path c:\import\intermediateca.cer | Import-Certificate -CertStoreLocation cert:\LocalMachine\CA

Connector disabled or absent.

Save first: save the output of Get-InboundConnector | Format-List to a text file, and note which connectors the Connectors page in the Exchange admin center shows as on or off.

Risk: creating or enabling a connector, as the next step does, changes who can relay through your tenant. Any server in the connector's IP or certificate scope can then relay mail as your domain, so do it only for a server you own.

If the connector is missing, create it with the settings on Microsoft's setup page: Connection from "Your organization's email server", and "Retain internal Exchange email headers" not selected. If it exists but is off, turn it on. To undo it, turn the connector off or remove it, and compare against the saved listing.

Confirm the fix

Send a test message from the application to an address inside your organisation, then to an outside address, and check that both arrive. Microsoft's setup page asks you to "send a test email from your device or application, and confirm the recipient receives it." A message that was refused with 550 5.7.64 has already produced a non-delivery report for the sender. Microsoft's pages do not say that Microsoft 365 holds such a message for later delivery, so send each affected message again once the test succeeds.

Example (illustrative): rds01 hosts an invoicing application that sends about 240 messages a day through Microsoft 365 using an IP-based connector. At 06:00 on Monday the firewall at contoso.com.au is replaced and the public IP changes. The connector is fixed at 08:00 on Tuesday. That is 26 hours. At 240 a day, that is 10 an hour, so about 260 messages (10 x 26) come back to the application as non-delivery reports. After the connector is corrected, the invoicing team has to send those 260 messages again.

What to watch afterwards

  • Add the connector check to every move or renewal checklist: public IP, certificate subject, intermediate certificates and SPF.
  • Keep a dated copy of the connector settings, so the next comparison takes minutes.
  • Watch for new 550 5.7.64 non-delivery reports for the first day. Any new report means relay is still refused.
  • Confirm the SPF record lists the new IP. Microsoft warns that without it, mail can land in Junk Email.

Risks and limits

These commands have not been run or lab-tested. The NDR page applies to relay from on-premises Exchange or IIS SMTP with certificate validation on the inbound connector. Other applications behave the same way on the printers and applications page, but that page gives only the IP-or-certificate cause for this error, not a full diagnosis. Microsoft's pages do not say how long a connector change takes to apply; test after saving rather than assuming.

Do not widen the connector to a wide IP range to stop the NDR. Microsoft's setup page says a device can send using any email address in an accepted domain. Name only the servers you own on the connector. If the new server is a third-party hosted service, Microsoft's setup page says: "You can't use SMTP relay to send email from a third-party hosted service (for example, Microsoft Azure) through Microsoft 365 or Office 365."

Sources