Errors while syncing Microsoft accounts

Problem

Error while syncing my Microsoft accounts (msn.com, outlook.com)

Context

After keep getting errors for over 5 days, and Clear/Rebuild cache didn’t help, I decided to remove both accounts and add them again.
Although they are added initially and I am getting the smtp/test emails, if I try to open them, or delete them, I am getting below message:
“In order to perform actions on this mailbox, you need to resolve the sync issue. Visit Preferences > Accounts for more information”

Email Provider

Outlook/MSN

Setup

  • OS and Version: Manjaro KDE Plasma X11. Kernel 6.6.10, KDE 5.27.10
    • Installation Method: Via AUR app store
  • Mailspring Version: 1.13.3

Error log:

    "accounts": [
      {
        "id": "02f5cb08",
        "metadata": [],
        "name": "....,
        "provider": "outlook",
        "emailAddress": "xxxxxx@msn.com",
        "settings": {
          "imap_host": "imap-mail.outlook.com",
          "imap_port": 993,
          "imap_username": "xxxxxx@msn.com",
          "imap_security": "SSL / TLS",
          "imap_allow_insecure_ssl": false,
          "smtp_host": "smtp-mail.outlook.com",
          "smtp_port": 587,
          "smtp_username": "xxxxxxx@msn.com",
          "smtp_security": "STARTTLS",
          "smtp_allow_insecure_ssl": false,
          "container_folder": ""
        },
        "label": "msn.com",
        "autoaddress": {
          "type": "bcc",
          "value": ""
        },
        "aliases": [],
        "syncState": "ok",
        "syncError": {
          "code": 134,
          "error": {
            "stack": "Error: null33941 [2024-01-29 10:50:17.095] [background] [critical] \n***\n*** Mailspring Sync \n*** An exception occurred during program execution: \n*** {\"debuginfo\":\"syncFoldersAndLabels - fetchAllFolders\",\"key\":\"ErrorAuthentication\",\"retryable\":false,\"what\":\"std::exception\"}\n***\n\n33941 [2024-01-29 10:50:17.095] [background] [critical] *** Stack trace (line numbers are approximate):\n*** ??:?        SyncWorker::syncFoldersAndLabels()\n*** ??:?        runBackgroundSyncWorker()\n*** main.cpp:?  main::{lambda()#3}::operator()() const\n*** main.cpp:?  _Bind_simple::operator()()\n*** main.cpp:?  thread::_Impl::_M_run()\n*** thread.o:?  execute_native_thread_routine()\n***\n\n/usr/share/mailspring/resources/app.asar.unpacked/mailsync: line 5: 33941 Aborted                 (core dumped) SASL_PATH=\"$SCRIPTPATH\" LD_LIBRARY_PATH=\"$SCRIPTPATH;$LD_LIBRARY_PATH\" \"$SCRIPTPATH/mailsync.bin\" \"$@\"\n\n    at ChildProcess.onStreamCloseOrExit (file:///tmp/nylas-build/electron-packager/linux-x64/mailspring-linux-x64-6Ns7Ou/resources/app/src/mailsync-process.ts:320:17)\n    at ChildProcess.emit (node:events:513:28)\n    at ChildProcess.emit (node:domain:489:12)\n    at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)",
            "message": "null33941 [2024-01-29 10:50:17.095] [background] [critical] \n***\n*** Mailspring Sync \n*** An exception occurred during program execution: \n*** {\"debuginfo\":\"syncFoldersAndLabels - fetchAllFolders\",\"key\":\"ErrorAuthentication\",\"retryable\":false,\"what\":\"std::exception\"}\n***\n\n33941 [2024-01-29 10:50:17.095] [background] [critical] *** Stack trace (line numbers are approximate):\n*** ??:?        SyncWorker::syncFoldersAndLabels()\n*** ??:?        runBackgroundSyncWorker()\n*** main.cpp:?  main::{lambda()#3}::operator()() const\n*** main.cpp:?  _Bind_simple::operator()()\n*** main.cpp:?  thread::_Impl::_M_run()\n*** thread.o:?  execute_native_thread_routine()\n***\n\n/usr/share/mailspring/resources/app.asar.unpacked/mailsync: line 5: 33941 Aborted                 (core dumped) SASL_PATH=\"$SCRIPTPATH\" LD_LIBRARY_PATH=\"$SCRIPTPATH;$LD_LIBRARY_PATH\" \"$SCRIPTPATH/mailsync.bin\" \"$@\"\n"
          },
          "signal": null
        },
        "authedAt": 1706525436.012,
        "color": "#0000ff",
        "__cls": "Account"
      }

I got the same problem today. Error when connecting to hotmail / outlook account with application password, even after application password reset.

EDIT : this happens also on my phone device with K9 Mail. Using OAuth2 instead of application password solve the issue.

How can I change that to Mailspring?

Don’t know :man_shrugging: I can only do that with K9 Mail
I tried to use Office 365 login instead of Outlook, but it doesn’t works too

I’ve been having the exact same problem for a while now as well.

I tried removing the account, reinstalling, and downgrading to an older version, none of which worked for long.

I have gotten them working for a short while when adding the accounts via the IMAP / SMTP option, but this no longer works and gives me this error;

Mailspring Version: 1.13.3-9a7e1a78
Platform: win32
Account State: invalid
Account Provider: imap
IMAP Server: imap-mail.outlook.com
SMTP Server: smtp-mail.outlook.com
--------------------------------------------
***

6952 [2024-01-29 21:11:00.431] [main] [info] Identity created at 1684130933 - using ID Schema 1
6952 [2024-01-29 21:11:00.432] [main] [info] ------------- Starting Sync (xxx.xxx@outlook.com) ---------------
6952 [2024-01-29 21:11:00.434] [metadata] [info] Metadata delta stream starting...
6952 [2024-01-29 21:11:00.434] [background] [info] Marking all folders as `busy`
6952 [2024-01-29 21:11:00.435] [background] [info] Syncing folder list...
6952 [2024-01-29 21:11:01.593] [background] [critical] 
***
*** Mailspring Sync 
*** An exception occurred during program execution: 
*** {"debuginfo":"syncFoldersAndLabels - fetchAllFolders","key":"ErrorAuthentication","retryable":false,"what":"Unknown exception"}
***

16744 [2024-01-29 21:11:01.978] [main] [info] Identity created at 1684130933 - using ID Schema 1
16744 [2024-01-29 21:11:01.979] [main] [info] ------------- Starting Sync (xxx.xxx@outlook.com) ---------------
16744 [2024-01-29 21:11:01.984] [background] [info] Marking all folders as `busy`
16744 [2024-01-29 21:11:01.984] [metadata] [info] Metadata delta stream starting...
16744 [2024-01-29 21:11:01.985] [background] [info] Syncing folder list...
16744 [2024-01-29 21:11:03.160] [background] [critical] 
***
*** Mailspring Sync 
*** An exception occurred during program execution: 
*** {"debuginfo":"syncFoldersAndLabels - fetchAllFolders","key":"ErrorAuthentication","retryable":false,"what":"Unknown exception"}
***

24480 [2024-01-29 21:11:03.618] [main] [info] Identity created at 1684130933 - using ID Schema 1
24480 [2024-01-29 21:11:03.618] [main] [info] ------------- Starting Sync (xxx.xxx@outlook.com) ---------------
24480 [2024-01-29 21:11:03.620] [background] [info] Marking all folders as `busy`
24480 [2024-01-29 21:11:03.620] [metadata] [info] Metadata delta stream starting...
24480 [2024-01-29 21:11:03.622] [background] [info] Syncing folder list...
24480 [2024-01-29 21:11:04.822] [background] [critical] 
***
*** Mailspring Sync 
*** An exception occurred during program execution: 
*** {"debuginfo":"syncFoldersAndLabels - fetchAllFolders","key":"ErrorAuthentication","retryable":false,"what":"Unknown exception"}
***

2096 [2024-01-29 21:11:05.210] [main] [info] Identity created at 1684130933 - using ID Schema 1
2096 [2024-01-29 21:11:05.211] [main] [info] ------------- Starting Sync (xxx.xxx@outlook.com) ---------------
2096 [2024-01-29 21:11:05.213] [background] [info] Marking all folders as `busy`
2096 [2024-01-29 21:11:05.214] [metadata] [info] Metadata delta stream starting...
2096 [2024-01-29 21:11:05.215] [background] [info] Syncing folder list...
2096 [2024-01-29 21:11:06.262] [background] [critical] 
***
*** Mailspring Sync 
*** An exception occurred during program execution: 
*** {"debuginfo":"syncFoldersAndLabels - fetchAllFolders","key":"ErrorAuthentication","retryable":false,"what":"Unknown exception"}
***

When I try to add the account with Office 365, I get this error;

An unknown error has occurred (mailsync: 3765269347)

When I try to add the account via Outlook.com / Hotmail, I get an Authentication Error, propting me to chech my username and password.
Where the IMAP log is;

----------IMAP----------
connect <mailcore::IMAPSession:001AF984>
* OK The Microsoft Exchange IMAP4 service is ready. [RwBWADMAUAAyADgAMABDAEEAMAAwADEAMQAuAFMAVwBFAFAAMgA4ADAALgBQAFIATwBEAC4ATwBVAFQATABPAE8ASwAuAEMATwBNAA==]
ssl connect imap-mail.outlook.com 993 2
OpenSSL version: OpenSSL 1.1.0f  25 May 2017
1 CAPABILITY
* CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+
1 OK CAPABILITY completed.
connect ok
login
2 LOGIN "xxx.xxx@outlook.com" *********
2 NO LOGIN failed.

I should also note that in some cases, the censored password is present in uncensored in plain text in some logs, I am not sure if this makes a difference though.

The problem seems do be general with application passwords :

The only solution seems to use OAuth2 login for Outlook for the moment, which is not available with Mailspring if I’m right ?

According to the first link by @Striffly, updated on Jan 31, 2024, MS reports that they’ve made adjustments to hopefully improve the situation.

I logged in to my Outlook account to see if there were any blocked sign in attempts, and while doing so it prompted me to add a recovery email to the account. As soon as I did that, mail started flowing into Mailspring again for the Outlook account in question. Probably just a coincidence on the timing, but I’m hoping it stays synced correctly now.

I’ll report back in a couple days if the connection has stayed consistent.

Mine too are working today, without logging to the accounts from a browser, just from my phone, but I was doing this yesterday too. I think MS made some changes and probably there was a bug, or they reverted them.