Having issues setting Office 365 as relay in postfix

yum install cyrus-sasl cyrus-sasl-plain cyrus-sasl-md5


[smtp.office365.com]:587 user@xompany.com:password


relayhost = [smtp.office365.com]:587
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_auth_enable = yes
smtp_generic_maps = hash:/etc/postfix/generic

smtp_tls_security_level = may
smtp_sasl_security_options = noanonymous

cat /etc/sasl2/smtpd.conf

pwcheck_method: saslauthd

mech_list: plain login


localhost postfix/smtp[6073]: 60B1E400E9F9: SASL authentication failed; server smtp.office365.com[] said: 535 5.7.3 Authentication unsuccessful [VI1PR07CA0165.eurprd07.prod.outlook.com]

what am i missing ? I see in some guides SSL certificates are used, if it's a must, what's procedure to obtain them ?

  • 1
    !!!! THIS IS SOLUTION !!!!!! mods keep delete my way how so solve this : Open the Microsoft 365 admin center and go to Users > Active users. Select the user, and in the flyout that appears, click Mail. In the Email apps section, click Manage email apps. Verify the Authenticated SMTP setting: unchecked = disabled, checked = enabled. When you're finished, click Save changes.
    – user956584
    Sep 27, 2020 at 11:09

2 Answers 2


In our case it was the "Azure Security defaults" in https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/Properties:

Security Defaults enabled:

SASL authentication failed; server smtp.office365.com[x.y.z.a] said: 535 5.7.3 Authentication unsuccessful

Security Defaults disabled (20min later):

relay=smtp.office365.com[x.y.z.a]:587, delay=17, delays=0.03/0.03/17/0.37, dsn=2.0.0, status=sent (250 2.0.0 OK

We are looking into the security setting exactly preventing SASL Auth.

EDIT: Without "Azure AD Premium" it is only possible to enable/disable AD security Defaults. With default settings, SMTP_Auth is legazy and not supported anymore. I still do not understand why SMTP_Auth is considered legacy

Some Background Information: https://practical365.com/azure-ad/what-are-azure-ad-security-defaults-and-should-you-use-them/

  • This actually helped me solve a completely unrelated SMTP Auth issue in my O365 tenant, so thank you!
    – SiennaD.
    Feb 14, 2021 at 5:32

Got it working, i missed one letter in username, once corrected it ran postmap hash:/etc/postfix/sasl_passwd,restarted postfix and messages started to flow

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.