Can't login with my university account - office 365, tried both Office 365 and IMAP/SMTP methods

Description

This bug happens when I try login in my student account (office 365), I tried login in Linux and Windows, with Office 365 and IMAP/SMTP methods and the same occurred.

The error message is in Portuguese but translating means: “Authentication error: verify your username and password. (SMTP)”

Just for the sake of knowing, I tried IMAP/SMTP method in Thunderbird and worked perfectly.

To Reproduce…

Steps to reproduce the behavior:

  1. Try add an Office 365 account.
  2. Choose Office 365 method or IMAP/SMTP.
  3. Try login.
  4. Receive error message.

Expected Behavior

  1. Try add an Office 365 account.
  2. Choose Office 365 method or IMAP/SMTP.
  3. Try login.
  4. Login successful.

Setup

  • OS and Version: Windows 10 build 19044.1706, Fedora 36 Workstation
  • Installation Method: Windows: installer, Fedora: dnf package manager
  • Mailspring Version: 1.10.3 in both

Additional Context

Logs SMTP part (I will hide with * parts that I don’t know if it’s compromising):
----------SMTP----------
connect smtp.office365.com 587
220 .outlook.office365.com Microsoft ESMTP MAIL Service ready at Mon, 13 Jun 2022 20:54:11 +0000
init
EHLO DESKTOP-

250-CP0
********.outlook.office365.com Hello [.*..]
250-SIZE 157286400
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250 SMTPUTF8
start TLS
STARTTLS
220 2.0.0 SMTP server ready
done
OpenSSL version: OpenSSL 1.1.0f 25 May 2017
init after starttls
EHLO DESKTOP-
***
250-CP0**********.outlook.office365.com Hello [.*..***]
250-SIZE 157286400
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-AUTH LOGIN XOAUTH2
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250 SMTPUTF8
AUTH LOGIN
334 ******
****==
334 *****
=
...
Authentication unsuccessful, SmtpClientAuthentication is disabled for the Tenant. Visit Enable or disable SMTP AUTH in Exchange Online | Microsoft Docs for more information. [CP0
.lamprd80.prod.outlook.com]

SASL_PATH:

SMTP Last Response Code: 535
SMTP Last Response: 5.7.139 Authentication unsuccessful, SmtpClientAuthentication is disabled for the Tenant. Visit Enable or disable SMTP AUTH in Exchange Online | Microsoft Docs for more information. [CP0**********.lamprd80.prod.outlook.com]

mailsmtp Last Error Code: 17
mailsmtp Last Error Explanation: MAILSMTP_ERROR_AUTH_LOGIN
mailsmtp Last Error Location: 10
mailsmtp Last Auth Type: 16

Same issue for me. I am using Ubuntu, but other than this the setup and the errors are the same.

Yeah, you’re going to have to reach out to whoever admins that Microsoft 365 accounts to see if they will activate IMAP & SMTP support on your teneant. They might not enable it…

... Authentication unsuccessful, SmtpClientAuthentication is disabled for the Tenant. Visit Enable or disable SMTP AUTH in Exchange Online | Microsoft Docs for more information. [CP0 .lamprd80.prod.outlook.com

Again both you and OP need to reach out to whomever administers those Microsoft/Office 365 tenants. They are ultimately who controls if IMAP and SMTP is enabled on their respective tenants…

This really needs to be a pinned topic because not every Microsoft/Office 365 tenant enables this functionality. You’ll need to either use a mail client like Outlook which supports Microsoft exchange natively, or another mail client that supports ActiveSync, EWS/EWA, or maybe MAPI if thats enabled…

Actually, every Microsoft/Office365 tenant that hasn’t expressly allowed SMTP auth for some strange reason in the past has this disabled, and for a reason. And turning it back on is not a solution.

I installed Mailspring thinking it actually supports Office365. Seems I was wrong. So apparently for Linux there are no O365 capable mail clients.

Im not 100% sure but you might be able to use Evolution with Microsoft/Office 365…

Edit: A quick Google search confirms this…though it has a bit of a learning curve:
https://wiki.gnome.org/Apps/Evolution/EWS/OAuth2
https://sites.utexas.edu/glenmark/2021/02/01/how-to-setup-your-office-365-email-using-evolution-ews-linux/