thunderbird / thunderbird-android

K-9 Mail – Open Source Email App for Android
https://k9mail.app/
Apache License 2.0
9.47k stars 2.42k forks source link

Deleted Emails remain in the inbox on server for mailfence account #7767

Closed Frozenjoghurt closed 2 weeks ago

Frozenjoghurt commented 3 weeks ago

Checklist

App version

6.802

Where did you get the app from?

Other

Android version

Android 12, /e/ OS-Version 1.21.1-s-20240325389527-stable-FP4

Device model

Fairphone 4

Steps to reproduce

  1. Setup a Mailfence account in K9 with Imap.
  2. Delete a Mail from the Inbox of a Mailfence Email account in the K9 App.
  3. Check the Mailfence Inbox via Webclient, the Mail is still in the Inbox and was not moved to the trash folder.

Expected behavior

The deleted Mail gets moved to the trash folder on the Server

Actual behavior

The deleted Mail is only deleted locally and stays in the Inbox on the Mailfence Server.

Things I've already tried that did not fix the Issue:

Things that I've tested that do work:

Other Notes:

Logs

k9mail-logs.txt

cketti commented 2 weeks ago

This seems to be a problem on the server's side. K-9 Mail is opening the folder in read-write mode.

04-20 18:33:18.896  6981  7003 V RealImapConnection: conn218628155>>> 32 SELECT "INBOX"
04-20 18:33:19.065  6981  7003 V ImapResponseParser: conn218628155<<<#null# [5, EXISTS]
04-20 18:33:19.066  6981  7003 V ImapResponseParser: conn218628155<<<#null# [2, RECENT]
04-20 18:33:19.067  6981  7003 V ImapResponseParser: conn218628155<<<#null# [OK, [UIDVALIDITY, 100677376]]
04-20 18:33:19.068  6981  7003 V ImapResponseParser: conn218628155<<<#null# [OK, [UIDNEXT, 720]]
04-20 18:33:19.069  6981  7003 V ImapResponseParser: conn218628155<<<#null# [FLAGS, [\Deleted, \Seen, \Answered, \Recent, \Draft]]
04-20 18:33:19.070  6981  7003 V ImapResponseParser: conn218628155<<<#null# [OK, [PERMANENTFLAGS, [\Deleted, \Seen, \Answered, \Flagged, \Draft, \*]]]
04-20 18:33:19.072  6981  7003 V ImapResponseParser: conn218628155<<<#32# [OK, [READ-WRITE], SELECT Completed]
…
04-20 18:33:20.480  6981  7003 V RealImapConnection: conn218628155>>> 33 UID MOVE 719 "Trash"
04-20 18:33:20.641  6981  7003 V ImapResponseParser: conn218628155<<<#33# [NO, Could not MOVE messages to mailbox: MOVE: Mailbox is read only: INBOX]

Please contact your provider and report this problem.

However, K-9 Mail doesn't handle this error well. We need to undo the local move (#7773) and report the error to the user (#1058).

cketti commented 2 weeks ago

It looks like the folder was opened in read-only mode before it was opened in read-write mode on the same connection. This is legitimate and should be correctly handled by the server.

See RFC 3501, section 6.3.1. SELECT Command

Only one mailbox can be selected at a time in a connection; simultaneous access to multiple mailboxes requires multiple connections. The SELECT command automatically deselects any currently selected mailbox before attempting the new selection.