Error Details
| Fact | Value | Source | Note |
|---|---|---|---|
| Exact error string | 550 5.7.506 Access Denied, Bad HELO | Exchange Online Protection (EOP) logs | -> Indicates invalid EHLO greeting |
| Affected build range | Microsoft 365 | Product documentation | -> Applies to all current builds |
| Registry key involved | None | Exchange Server logs | -> Configuration issue, not registry-based |
| Relevant service/endpoint URL | https://protection.outlook.com | EOP documentation | -> EOP enforces EHLO standards |
| Log line signature | EHLO <invalid_name> | SmtpSend protocol logs | -> Identifies incorrect HELO usage |
Log Files to Check
%ExchangeInstallPath%TransportRoles\Logs\Hub\ProtocolLog\SmtpSend\SEND*.LOGExchange Online PowerShell: Get-MessageTrace
What This Error Actually Means
The error code550 5.7.506 Access Denied, Bad HELO indicates that Exchange Online Protection (EOP) has rejected an inbound SMTP connection due to an invalid HELO/EHLO greeting from the sending host. Specifically, the connecting server announced itself using the recipient's domain name or a non-routable hostname (e.g., *.mail.protection.outlook.com or localhost) instead of its own fully-qualified domain name (FQDN). This behavior is characteristic of spambots, as legitimate servers always identify themselves using their own public FQDN in the HELO/EHLO command.
The error originates from EOP's SMTP filtering logic, which enforces RFC 5321 compliance for the EHLO argument. When a sending host violates this rule by announcing an invalid or non-routable hostname, EOP terminates the connection immediately with this specific error code.
Affected Versions and Scope
This issue affects all Microsoft 365 tenants using Exchange Online Protection (EOP), regardless of their subscription tier. It is not limited to any specific OS build range but rather depends on the configuration of the sending host's SMTP client or server. The error does not relate to IP reputation, SPF/DKIM/DMARC failures, or banned IPs, which produce different error codes such as5.7.501, 5.7.509, or 5.1.8.
Where To Look First: Logs and Event IDs
To diagnose this issue, examine the following log sources:- SmtpSend Protocol Log: Locate the file at
%ExchangeInstallPath%TransportRoles\Logs\Hub\ProtocolLog\SmtpSend\SEND*.LOG. Search for the exact log line signatureEHLO, followed by the error response550 5.7.506 Access Denied, Bad HELO. - Exchange Online PowerShell: Use the cmdlet
Get-MessageTrace -StartDate (Get-Date).AddHours(-2) -EndDate (Get-Date)to confirm whether the message was rejected at the EOP boundary. A rejected session will not show a "Delivered" status in the results.
4201 (EHLO command received) and 4203 (Connection rejected due to invalid EHLO).
Root Causes
1. Misconfigured On-Premises Exchange Send Connector
The most common cause is an on-premises Exchange Server configured with an incorrect FQDN in its Send Connector settings. For example, the connector might be set to announce itself ascontoso.com (the recipient domain) instead of the organization's public mail server name like mail.contoso.com. This can occur during initial setup or after a domain rename operation.
2. Devices with Default SMTP Client Configuration
Multifunction printers, scanners, or line-of-business applications often ship with default SMTP client configurations that announce themselves using the target hostname (e.g.,*.mail.protection.outlook.com) or an internal name like localhost. These devices need their HELO/EHLO settings updated to use a valid public FQDN.
3. Hybrid Deployments with Misconfigured Relays
In hybrid environments, third-party relays or EOP connectors might be configured to announce an invalid hostname during the EHLO exchange. This can happen if the relay's configuration does not properly map to the organization's public FQDN.Fix Procedure
- Verify Current Configuration:
Get-SendConnector | Format-List Name,Fqdn,SmartHostsCheck if theFqdnproperty matches your organization's public FQDN (e.g.,mail.contoso.com). If it does not, proceed to step 2. - Update Send Connector Configuration:
Set-SendConnector -Identity "Outbound to Internet" -Fqdn mail.contoso.comReplacemail.contoso.comwith your organization's actual public FQDN. Confirm the change with:Get-SendConnector | Where-Object {$_.Name -eq "Outbound to Internet"} | Format-List Fqdn - Enable Protocol Logging (if not already enabled):
Set-SendConnector -Identity "Outbound to Internet" -ProtocolLoggingLevel VerboseThis will help diagnose future issues by capturing detailed SMTP handshake information. - Test the Configuration:
Use a tool like
telnet contoso-com.mail.protection.outlook.com 25to manually initiate an SMTP session and observe the EHLO response. A successful configuration will show:EHLO mail.contoso.com 250-Contoso Microsoft ESMTP MAIL Service ready at ... - Update Device or Application Configuration: For devices like MFPs, access their SMTP settings and update the HELO/EHLO field to use your organization's public FQDN instead of the target hostname or IP address.
- Hybrid Deployments:
Review EOP connector settings in the Exchange Admin Center:
Exchange admin center > Recipients > Inbound connectors. Ensure the
SenderDomainsandEFSkipIPsfields are correctly configured to match your organization's public FQDN.
Important: Before making changes, verify that the FQDN you intend to use matches the certificate name for TLS encryption. Mismatched certificates can cause additional SMTP errors.
Error Code Variants
| Error Code | Description | Distinguishing Factor |
|---|---|---|
| 5.7.501 | Spam Reputation Block | Indicates the sending IP is listed in Microsoft's blocklist due to spam activity. |
| 5.7.506 | Bad HELO/EHLO Greeting | Specifically triggered by an invalid or non-routable hostname in the EHLO command. |
| 5.7.509 | DKIM/DMARC Policy Violation | Occurs when the message fails DKIM or DMARC checks, unrelated to HELO configuration. |
| 5.1.8 | Banned IP Address | Indicates the sending IP is explicitly banned by the recipient organization. |
Verification
After implementing the fix, perform the following verification steps:- Check SmtpSend Logs:
Review the log file at
%ExchangeInstallPath%TransportRoles\Logs\Hub\ProtocolLog\SmtpSend\SEND*.LOG. Look for a successful EHLO exchange:EHLO mail.contoso.com 250-Contoso Microsoft ESMTP MAIL Service ready at ... - Message Trace Verification:
Use the Exchange Admin Center or PowerShell to confirm successful delivery:
Exchange admin center > Mail flow > Message trace or
Get-MessageTraceDetail -Identity <message-id>. A successfully delivered message will show a status of "Delivered" instead of being rejected at the EOP boundary. - Network Diagnostics:
Perform a DNS PTR record check for your sending IP and ensure it resolves to your organization's public FQDN:
Resolve-DnsName -Type PTR <sending-ip>
Diagnostic Shortcut: Use the built-in PowerShell cmdlet
Test-NetConnection contoso-com.mail.protection.outlook.com -Port 25 to quickly verify connectivity and observe the EHLO response directly.
Prevention
To prevent recurrence of this issue, implement the following measures:- Monitor Send Connector Configuration:
Regularly audit your Send Connectors using:
Get-SendConnector | Format-List Name,Fqdn,SmartHosts - Enforce FQDN Usage in Device Configurations: Update organizational standards to require the use of public FQDNs in all SMTP client configurations for devices and applications.
- Implement DNS Validation Scripts:
Create a script to periodically check that your sending hosts' EHLO names resolve correctly to their public IPs. For example:
Resolve-DnsName mail.contoso.com | Select-Object IPAddress