thunderbird / thunderbird-android

Thunderbird for Android – Open Source Email App for Android (fka K-9 Mail)
https://thunderbird.net/mobile
Apache License 2.0
11.01k stars 2.51k forks source link

Cannot copy or move message that is not synchronized with the server (IMAP) #823

Open Brackmeister opened 9 years ago

Brackmeister commented 9 years ago

Steps to reproduce: Use "archive" for a message when you don't have an IMAP archive folder on the server.

Expected behaviour: I only hit that function by accident. I have no idea what it is supposed to do. But now that the email message is moved to a (local) archive folder, I expect to be able to move it back to the IMAP folder it was in before.

What happens instead: When I select copy or move I get the message "Cannot copy or move message that is not synchronized with the server" (I use German language so that might not be the exact English phrase) When I delete the message it goes to the Trash folder, but from there I cannot copy/move it either. Effectively this email is kind of lost.

This is similar to a bug[*] in the old Google Code tracker at https://code.google.com/p/k9mail/issues/detail?id=861 which was never resolved.

[*]: I consider this a bug as there is no way of undoing this, no confirmation is required, but an IMAP message "archived" in this way is essentially gone for good

diegobersanetti commented 8 years ago

I confirm the existence of this bug, it happened to be also by accident: I did not mean to delete a message but it happened, and I did not have the Trash folder pointing correctly to the IMAP folder yet, so such message is buried in this local Trash folder and I cannot recover it.

LongmanU commented 7 years ago

This has been annoying me for years now. Accidently I use a gesture that moves a message to the Trash (so I think - I don't know what I do, but it is in Trash afterwards), and I cannot get it back.

So, when it worked this way, why doesn't it work the way back? I have to forward the mail to my own address each time this happens.

Please, please, make it work!

bcraigie commented 7 years ago

Me too. I found that messages sent from my phone (imap account) were being stored in the local sent folder of the phone and not the imap INBOX.Sent folder. I can't move these to the correct Sent folder. The whole point of imap is you see the same folders and emails everywhere. I found the setting to change the destination folders, but cannot move the locally sent ones.

A fix for this would be good. It should be easy to code the fix to move an email from a local folder to an imap folder. :-)

vigna commented 7 years ago

Same here. Sometimes I trash accidentally a message and there's no way to get it back to the inbox except by forwarding.

kripper commented 7 years ago

This bug is still present. Messages are getting "lost" so this bug should be high prio. I'm not sure if I triggered by accident a gesture, but some messages just disappear and are only visible in the "All messages" option.

potyt commented 6 years ago

What a horrible bug. How can is sit here untouched for 2+ years? Messages can be lost by an accidental glance of a finger, and therr is no way back. Forwarding is not a suitable solution to this either. I'm amazed k9 people aren't all over this.

LongmanU commented 6 years ago

Messages can be moved from Trash back to Inbox after synchronizing the Trash Folder (swype from top to bottom / drag message list down). But I'm still not happy about silently trashing mails by an unwanted swype action.

EnviroEllen commented 6 years ago

Adding my plea for a fix to this behavior.

I use K9 as a POP3 client. I believe that all of my K9 folders are local to my phone, except when I initiate a sync action. Why shouldn't I be able to move a message out of my [local] Trash folder into another local folder?

tadam98 commented 6 years ago

I also have this problem on my Android phone. I cannot move messages between synchronized folders.

Adambean commented 5 years ago

Every time. When I see this message I just think "well sodding synchronise it then!?". This should only ever happen when you're offline.

economicpygmy commented 5 years ago

I can confirm this annoying bug is still present. I now have zombie messages I cant delete along with a folder. I didn't even want to archive, hit the button by mistake.

dopefishh commented 4 years ago

Every time. When I see this message I just think "well sodding synchronise it then!?". This should only ever happen when you're offline.

Well, sometimes it is not possible to synchronize. For example, I have an extra account setup just for sending. Email sent with that account appears in the Sent box for that account, but the IMAP information is bogus since I only use it for sending. There are many other reasons why you might not be able to synchronize. Maybe your server is down, your quotum is reached, etc.

rkoe commented 4 years ago

So, this bug now exists ~10 years (with the previous bugreport on code.google.com), and nobody cares to fix it, and there's not even a workaroud. WTF? Seriously? Hello K-Mail-developers?

Throwing mails away (or locking them unmovable, as done here my K-9 Mails) is a no-go, which always must be prevented and fixed as soon as possible. Otherwise, the mail client is unusable. But nothing happens here, and nobody cares.

Apparently, the developers don't give a shit about their users and their mails. That's sad, because otherwise K-9 Mail would be a nice app.

Adambean commented 4 years ago

Well, sometimes it is not possible to synchronize. For example, I have an extra account setup just for sending. Email sent with that account appears in the Sent box for that account, but the IMAP information is bogus since I only use it for sending. There are many other reasons why you might not be able to synchronize. Maybe your server is down, your quotum is reached, etc.

I get that there will be situations where syncing isn't possible, but I don't think my situation quite falls into those you mentioned.

This impacts my own mail servers on the same network as well as other ones in data centres equally, and the problem is very easily reproducible. -- Each time I can start up Thunderbird on a PC in the same network and manage messages without any problem.

rkoe commented 4 years ago

Since the developers unfortunately don't care, I've tried to get some workarounds:

  1. Forward the mail to yourself. Then, store the message and put it into your mail-directory again. Only stores the plain text; and if you can manually add mails to your IMAP-server; ignores attachments, formatting, html, mail headers.

  2. Forward the mails as attachment to yourself. Then, store the attached file and put it into your mail-directory again. Works with simple plain-text mails (incl. mail header) and if you can manually add mails to your IMAP-server; does not work with html-mails and attachments but instead creates an empty mail.

  3. Tell K-9 Mail to re-insert the mails via IMAP to the server, via raw access to the K-9 Mail database. Works with plain text mails and html mails; and probably only on rooted phones; but "deletes" attachments (attachments still exist, but with size=0), modifies the mail-header and maybe re-encodes the mail.

    Instructions (use with care, and always make backups before!):

    • close K-9 Mail (and probably stop background sync)
    • run Termux, and in Termux:
      
      pkg install sqlite
      su
      cd /data/data/com.fsck.k9/databases
      mkdir _backup
      cp -a * _backup

/data/data/com.termux/files/usr/bin/sqlite3 *.db

list all "local" mails

SELECT folder_id, uid FROM messages WHERE uid LIKE "K9LOCAL:%";

tell K-9 Mail to add the messages to the IMAP server

(probably has to be adapted if you're using several IMAP servers)

INSERT INTO pending_commands (command, data) SELECT 'append', '{"databaseId":0,"folder":"' || name || '","uid":"' || uid || '"}' FROM (SELECT (SELECT name FROM folders WHERE id=messages.folder_id) AS name, uid FROM messages WHERE uid LIKE "K9LOCAL:%");

list all pending "add mail to server" operations

SELECT * FROM pending_commands;


   - start K-9 Mail
   - sync mails 

-----

Unfortunately, none of the workarounds really works well, so:  
To the K-9 Mail developers: Please fix this or at least add a warning/confirmation dialog when a user tries to move a mail to a local folder (=before the uid in the messages-table is set to "K9LOCAL:...").
LongmanU commented 4 years ago

Did you also try to simply swype down when viewing the message list in the local folder? My understanding is, that the folder then is being synchronized with the server. After that, you should be able to to move the message back to the original folder in the normal way.

Since someone wrote that a few years ago in this thread, I was successful with it and hadn't got any more problems with this issue. But I'm not sure if this works if you're offline - will have to wait until a network connection is available, I think.

dopefishh commented 4 years ago

This workaround only works if you can sync to begin with.

rkoe commented 4 years ago

Did you also try to simply swype down when viewing the message list in the local folder?

Yes.

My understanding is, that the folder then is being synchronized with the server.

The folder is then synchronized -- except all "local" messages, which are not synchronized. So, this does not help.

After that, you should be able to to move the message back to the original folder in the normal way.

No. As soon as K-9 Mail marks the mails as "local" (="K9LOCAL:..." in the uid-column of the messages-table in the SQLite-database), it will never sync them to the server again, and K-9 Mail even prevents moving the mails to an other folder for whatever reason (except for moving them to the Trash).

rkoe commented 4 years ago

This workaround only works if you can sync to begin with.

If you cannot sync with your IMAP server at all, you should check the network connection and/or account settings. The workarounds are only intended for the case of this issue -- when you can generally can sync your mails with the IMAP server, except for some mails which K-9 Mail (accidentally) stores locally; these workaround then can more or less sync these "locally stored" mails back to the IMAP server.

dopefishh commented 4 years ago

I cannot and do not want to sync because of what I said before: a send only mail account.

Quibky commented 4 years ago

Extremely frustrating, I deleted a returned mail sent to a bad address and apparently because it was in thread view it deleted the forwarded message as well. There is really no excuse for this to be a problem for 10 years.. how can I see it in my trash and not be able to move it?!

potyt commented 4 years ago

Moved to FairMail, after being annoyed by this for a while, and other quirks and oddities, a real breath of fresh air!

heeplr commented 3 years ago

Wow, almost 6 years. Not much hope but reporting anyway:

I stumbled upon this for a secondary IMAP account, that is only used to send mail on mobile, not receive. So I disabled syncing of folders years ago. Now I noticed that sent messages were not stored on the server (of course). I learned that disabling syncing for the "sent" Folder was a bad idea. (Seemed unnecessary waste of data plan at the time and probably got the settings wrong).

This wouldn't be a big problem if I could manually sync the "Sent" messages from the phone to the server from time to time but that doesn't seem to be possible due to this bug.

Player701 commented 3 years ago

I seem to be experiencing this issue as well, although I have set up my K9 so that all folders are supposed to be synchronized with the server ("Folders" -> "Move/copy destination folders" = "All", "Folders to display" = "All"). The problem is, just recently it seemed to have worked perfectly: moving, archiving messages, marking them as spam etc. would result in these actions being synchronized with the server as they should be. Now, however, it appears that whenever I move the message to any other folder except Trash, this action is not reflected on the server, and any further attempts to move the message (except to Trash) result in the "Cannot copy or move message..." error.

The thing is, I would synchronize it with the server if I knew how to do it, but I can't find this function anywhere. I tried swiping down in the message list, and it does seem to trigger an update of the folder's contents, but it does not actually synchronize the problematic message with the server. Restarting the app and even rebooting my device does not fix the problem. I can only make the message visible again in K9 by first deleting it on K9's side and then moving it to some other folder via another IMAP client (e.g. webmail).

This seems to be a very serious issue because it results in de-syncing of folder contents between K9 and the IMAP server, and what's worst is that it can happen unknowingly to the user (they won't notice unless they try to move the message again). All messages moved between IMAP folders should be synchronized by default, if it doesn't happen then it's a bug.

UPD: Just as I've written this, it seemed to have started working normally again. This is extremely werid. Something fishy is most certainly going on here.

mstyp commented 3 years ago

Echoing what others have said, this is a really serious bug. I now have 100+ emails that only exist in k9 mail that need to be re-synced back my server, I am going to have to go through and forward them to myself ONE AT A BLOODY TIME. gah.

This would not be so frustrating if It where not for the fact that I can see that this issue has been around for YEARS and gone unfixed.

Player701 commented 2 years ago

I was able to reproduce this by switching my internet connection from Wi-Fi to 4G while K9 Mail was running (push was also enabled). The following steps were taken:

1) Rebooted the phone, K9 started up, 4G was enabled. Everything worked normally. 2) Turned off 4G and turned on Wi-Fi, everything still worked normally. 3) Turned off Wi-Fi and turned on 4G again, and K9 suddenly stopped synchronizing deleted/moved messages. 4) Switching back to Wi-Fi from 4G didn't help. But stopping K9 completely via the app manager and starting it again did, though.

I'm not sure if this is a reliable way to reproduce the issue, maybe I'll test again when I have sufficient time for that.

gkhourii commented 1 week ago

Hello, I would like to take a shot at this issue. I will be working with @dnicules on this as well as issue #7688 .