logo
search
Microsoft 365 Error Codes

Fix Postfix SASL Authentication Fails with Microsoft 365 Error 535 5.7.139

Huma Ashraf ChHuma Ashraf Ch Oct 15, 2026 868 views

Question details

The user needs to fix a Postfix mail server authentication failure to Microsoft 365 after tenant security policies were updated.

How to Fix Postfix SASL Authentication Failure Error 535 5.7.139 in Microsoft 365
Product
Microsoft 365
Device & OS
not provided
Scenario
Attempting to send email through Microsoft 365 using a Postfix mail server after Security Defaults have been enabled for the tenant.
Observed behavior
Postfix authentication is blocked and returns error 535 5.7.139, even though Authenticated SMTP and an app password were previously configured and working.
Before you start

Verify that you have Microsoft 365 Global Administrator privileges, as you will need to access the Exchange admin center and potentially Microsoft Entra ID (formerly Azure AD) to configure new relay settings.

Solution 1Recommended

Configure a Microsoft 365 SMTP Relay Using an IP-based Connector

Set up an inbound connector to allow your Postfix server to securely relay emails through Microsoft 365 without relying on blocked legacy basic authentication.

Because Security Defaults strictly disable basic legacy authentication tenant-wide, standard SMTP auth with app passwords is no longer effective. Setting up an IP-based SMTP relay connector circumvents this limitation securely for on-premises or cloud servers with a static IP address.

1
Access the Exchange admin center

Log in to the Microsoft 365 Exchange admin center using your administrator credentials.

2
Create a new mail flow connector

Navigate to 'Mail flow' in the left-hand menu and select 'Connectors'. Click 'Add a connector'.

3
Set the routing scenario

Select 'Your organization's email server' as the source, and 'Office 365' as the destination, then click 'Next'.

4
Authenticate the sending IP

Choose the option to verify the sender by IP address, and enter the public static IP address of your Postfix server.

5
Update Postfix configuration

Modify your Postfix main.cf file to relay mail directly to your domain's MX endpoint (e.g., yourdomain-com.mail.protection.outlook.com) on port 25 instead of using smtp.office365.com.

Configure a Microsoft 365 SMTP Relay Using an IP-based Connector
Static IP Requirement: This method requires your Postfix server to have a dedicated, static public IP address. Additionally, you must ensure your SPF record includes this IP address to prevent relayed emails from being marked as spam.
Free Microsoft Office alternative

Simplify Your Workflow with WPS Office

While troubleshooting complex Microsoft 365 administrative configurations and server errors like SASL auth failures, you can rely on WPS Office for a straightforward document productivity experience. WPS Office is a free, highly compatible alternative to Microsoft Office that lets you handle all your daily tasks without heavy enterprise management overhead.

  1. 1. Download the installer: Visit the official WPS Office website and click the free download button for your operating system.
  2. 2. Install the software: Run the downloaded installer and follow the on-screen instructions to complete the setup.
  3. 3. Start creating documents: Open WPS Office to instantly view, edit, or create documents with perfect Microsoft Office compatibility.
Fully compatible with Microsoft Office formats including .docx, .xlsx, and .pptx.Lightweight installation with zero complex tenant or server administration required.A complete all-in-one suite featuring powerful tools for Word, Excel, PowerPoint, and PDF editing.Free to use with an intuitive, familiar user interface for immediate productivity.
microsoft office alternative - wps office

Frequently Asked Questions

Why does error 535 5.7.139 occur after enabling Security Defaults?

Microsoft 365 Security Defaults automatically block legacy authentication protocols to protect against compromised credentials. This includes the basic SMTP authentication used by older Postfix setups, resulting in the 535 5.7.139 error.

Can I bypass Security Defaults for a single mailbox in Microsoft 365?

No, Security Defaults apply to the entire tenant. If you need granular control to allow legacy authentication for specific accounts, you must disable Security Defaults and utilize Conditional Access policies, which require Azure AD Premium licenses.

Does an app password still work for SMTP auth if Security Defaults are on?

No. When Security Defaults are enabled, legacy authentication is strictly blocked tenant-wide. Consequently, app passwords will no longer work for SMTP client submission via smtp.office365.com.

What is the easiest way to allow a Linux server to send mail through Microsoft 365?

The easiest method, assuming your server has a static public IP, is to configure an IP-based inbound connector in the Exchange admin center. This allows mail relaying on port 25 without requiring any user authentication.