Deltachat-android: Does not work with office 365 or outlook

Created on 17 Sep 2017  路  27Comments  路  Source: deltachat/deltachat-android

App refuses to authenticate with office 365 or outlook for smtp. (STARTTLS)
Server: smtp.office365.com/smtp-mail.outlook.com Port: 587
I am using my full email address as login name and the same password as for IMAP (which I think works).
For thunderbird, I have to set the authentication to "Normal Password" (and then I am able to send mail just fine.)
Thanks.

All 27 comments

I can confirm that I can't login either. I'm using a Microsoft Exchange 2013 account. Any chance this will be fixed in a future release? 馃憤

Thank you for your hint.

Any chance this will be fixed in a future release?

Of course there are chances, it's just a thing of time and money ...

Can anyone provide a testing account?

You can create al account for free (of charge).

An*

Thanks. I just added an alias adress and set it to IMAP. 馃憤

Confirmed it's not working for me, either. Hopefully you'll be able to find something.

Performed test with own account and got:

hh:mm:18.402 I com.b44t.messenger: No worthy mechs found
hh:mm:18.406 E DeltaChat: Error: SMTP-login failed for user [email protected] (Login failed)

Sent full logs (logcat zipped) to r10s.

hh:mm:18.402 I com.b44t.messenger: No worthy mechs found

I think this is related to missing configuration in the Android UI, which leads to wrong setting of the server_flags.
When I tested with Delta Chat Core, I set the value for server_flags to 66052. With this value I was able to connect (to office365 server).

Here the calculation:

4 (MR_AUTH_NORMAL) + 10000 -> (MR_SMTP_SOCKET_STARTTLS) + 200 -> (MR_IMAP_SOCKET_SSL)
=> 10204 (hex) => 66052 (dec)

When I use Android and try to connect, I only see this configured in sqlite db:
11|server_flags|66048

After changing the value in sqlite manually to 66052, the error message from above is gone (I am still not able to connect successfully, though. I receive a Connection refused).

Searching the web leads to some hints regarding authentication mechanism ("mechs") problems, too.

The authentication mechanism setting (flag) is not available in the UI and not used. I think this must be added.

Suspecting the problem in "mrmailbox_configure.c" ... seems the intention was to hide this setting from the user.

Is there anything that I could do in order to solve this issue?

iirc @Ampli-fier has a workaround, however, i personally have not tried this out yet.

I get it. I'll keep an eye on this. Delta chat is exactly what I was looking for, but my main account is a outlook account. Anyway, congratulations. The app is really great.

sooner or later, the outlook support will be fixed :)

Unfortunately, I have no workaround. Connecting with Core works straight when setting all params manually.

A possible workaround I had in mind was to copy the DB content from Linux (Mint) - where Core is running - to Android. Doing so would skip the (potentially buggy) _configure_ part and only run _connect_.
I tried that and connecting with IMAP works fine, but with SMTP not:

mm:32.007 I DeltaChat: T2: Connecting to SMTP-server "smtp.office365.com:587" via Socket...
mm:32.277 I DeltaChat: T2: Switching to SMTP-STARTTLS.
mm:32.480 I DeltaChat: T2: Connection to SMTP-server ok.
mm:32.480 I DeltaChat: T2: Login to SMTP-server as "<user>@<domain>.com"...
mm:32.653 I com.b44t.messenger.beta: No worthy mechs found
mm:32.654 W DeltaChat: T2: SMTP-login failed for user <user>@<domain>.com (Login failed)

Here the successful attempt with Core:

T2: Connecting to SMTP-server "smtp.office365.com:587" via Socket...
T2: Switching to SMTP-STARTTLS.
T2: Connection to SMTP-server ok.
T2: Login to SMTP-server as "<user>@<domain>.com"...
T2: SMTP-Login ok.

The same Core version (0.16) is used and the same sqlite DB content ... How can this be?!?

Today is Friday, the 13th ... and it is a good day :)

I found a change in the configuration for SASL (where the No worthy mechs found comes from) that makes it possible to log in to the smtp.office365.com server with STARTTLS.

The mechanism that is missing is called LOGIN.

When I enable this in config.h with #define STATIC_LOGINand compile a new version of DC for Android, then I get

04-13 22:54:03.299 I DeltaChat: T3: SMTP-Login ok.

I still need to 'hack' the configure part to correct the server_flags.

For rooted phones it is easy. Start DC (initial) and enter the settings for Office365 and try to connect. It will fail and you must stop DC on the phone. Open a root shell and do:

cd /data/data/com.b44t.messenger*/files
sqlite3 messenger.db "update config SET value='66052' where keyname='server_flags';"

Restart DC and go back to the configuration screen. Click the checkmark to connect ...

This is how it worked for my account/settings:

*IMAP*
server: outlook.office365.com
port: 993
  connection-security: SSL_TLS_REQUIRED
  authentication-type: PLAIN

*SMTP*
server: smtp.office365.com
port: 587
  connection-security: STARTTLS_REQUIRED
  authentication-type: PLAIN

Hi Ampli-fier, I followed your steps, but I got the error "SMTP-Socket connection to smtp-office365.com:587 failed (connection refused).

Did you compile a new version with the change in config.h?

When you tried, you used

smtp-office365.com:587 or
smtp.office365.com:587?

I forgot to change the config.h ..
But now I have compiled again and the new apk keep crashing after install...
I'm sure I'm doing something wrong, so I'll wait for updates from here..

What a pity. Did you ever manage before to compile your own version of DC?

These steps should work:

  1. Edit the file
  2. Go to folder deltachat-android-0.16.0/MessengerProj/jni (depending on the version)
  3. Call ndk-build (from android-ndk-r14b)
  4. Use Android Studio to compile a new version with "Build APK(s)"

I'm pretty sure that the issue is fixed with the above PR.

The wrong flags that I mentioned above are only temporary. They result from the selections in the Android UI and are written to the Database before the Core part starts.

In "mrmailbox_configure.c" the AUTH flags are added before the attempt to login (both: IMAP & SMTP).
Now, with the mech available, both logins succeed and the configuration can be finished.

Worth mentioning that the smtp.office365.com server sometimes seems not to respond too fast.

By reaching this point, DC write the used flags to the database (as configured_server_flags):

localhost files # sqlite3 messenger.db "select * from config where keyname like '%flag%';"
8|server_flags|66048
43|configured_server_flags|66052
localhost files #

I tried to follow the steps you mentioned before. But I'm just an user that liked DC a lot and I this was the first time I tried to compile an Android app.. So I surely messed up in some steps because the app crash when I open it.

Anyway, thanks for the help. I will wait for an update on F-droid.

@wilsonrljr the pull request is merged and 0.17.0 or later will contain the fix then.

so this should be working now and can be closed?

@Karkus476 @Wiredframe does it work with the latest version? Can we close this issue? Or can you provide test-account credentials so I can have a look into this?

Tested with 0.17.3 and a [email protected] account: Leaving all automatic in connection parameters does not work but it works when entering connection parameters specified in the account settings.

Ok. The autoconfig for outlook is a separate issue. Somebody should:

after they integrated the config, it should work in thunderbird and DC automatically. You can use multiple domains in the file, I think it's the same for outlook.de, outlook.com etc.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gerryfrancis picture gerryfrancis  路  4Comments

adbenitez picture adbenitez  路  4Comments

pschwede picture pschwede  路  4Comments

adbenitez picture adbenitez  路  4Comments

adbenitez picture adbenitez  路  4Comments