SMTPAuthenticationError 535 5.7.139 Microsoft365

Hello all,

since March 2, emails are no longer sent in Gitlab.
The settings were entered into gitlab.rb according to the support page and worked until March 2.
No changes were made to the Gitlab server, nor to Microsoft 365:

gitlab_rails[‘smtp_enable’] = true
gitlab_rails[‘smtp_address’] = “
gitlab_rails[‘smtp_port’] = 587
gitlab_rails[‘smtp_user_name’] = “mail”
gitlab_rails[‘smtp_password’] = “pw”
gitlab_rails[‘smtp_domain’] = “domain”
gitlab_rails[‘smtp_authentication’] = “login”
gitlab_rails[‘smtp_enable_starttls_auto’] = true
gitlab_rails[‘smtp_openssl_verify_mode’] = ‘peer’
gitlab_rails[‘gitlab_email_from’] = ‘mail’
gitlab_rails[‘gitlab_email_reply_to’] = ‘noreply@xxx’

When I send a test mail I get the following error message:

:SMTPAuthenticationError (535 5.7.139 Authentication unsuccessful, the request did not meet the criteria to be authenticated successfully. Contact your administrator. [FR2P281CA0061.DEUP281.PROD.OUTLOOK.COM 2023-03-14T13:27:16.409Z 08DB23F27AE3EB90])

Multifactor authentication has been disabled for the user. Login to is possible with the user. I can also send and receive mails via Outlook with the user.

But this does not work via Gitlab.

Can you please help me, I am stuck here?


You do know that Microsoft have been disabling SMTP password authentication right? some people had this happen already back in October/November last year (the company I work for uses O365/Exchange and has already had this problem). You will have to look at changing it to use another method, eg: oauth. There was an issue open about it: Support email sending via Microsoft Graph API with OAuth2 (#341908) · Issues · / GitLab · GitLab but not sure what the status is.

Or you do for example an alternative method for sending emails from your Gitlab install. For example, I configured postfix on my system to send/receive emails for my domain and don’t use the SMTP settings like you have listed above. The docs list various alternatives for configuring SMTP: SMTP settings | GitLab