Mail not clearing list of emails that have been deleted from server

Just to clarify for the other people finding this “tip”: this procedure can lead to inconsistencies. You may screw the logic of the Mail database cache. Do it only if you really know what you are doing. Ensure no other clients (no open tabs) are connected.

1 Like

I tried this, and it did fix the “orphaned” messages issues, but now all the From from all the newly synced e-mails are messed up (it just shows a From that appears in other e-mails but is not the real one).

I looked more into the available oc_mail_* tables and their contents and decided to do the following:

  1. occ maintenance:mode --on
  2. Backup the oc_mail_* tables
  3. Truncated oc_mail_recipients, oc_mail_classifiers, oc_mail_mailboxes and oc_mail_message_tags (and oc_mail_messages). Most of the other oc_mail_* tables where empty for me, I basically decided to only keep oc_mail_accounts and oc_mail_tags because it had some references to nextcloud users, apparently.
  4. occ maintenance:mode --off
  5. occ mail:account:sync -f ID

And now it seems to work.

Given that this messed up cache seems to be a fairly common thing, it might be good if the Mail app provides a sane occ mail:cache:clean or similar command to clear the e-mail cache and resync without users having to reverse engineer the mail app or trying to truncate random tables.

As said in the other message, do this at your own risk, but again, it would be nice if users had a bit more support here so they don’t have to take such a high risk! :slight_smile:

Thanks!

Now I deleted some e-mail from another IMAP client and again I get the message still present in the Mail app but it says “not found” when clicking on them. There seem to be something really wrong with the Mail app. Searching for GitHub issues I found this, maybe it is useful for other people reaching this post: Old mails deleted on other clients still show up as unread in Mail, when opened "Not found" · Issue #8223 · nextcloud/mail · GitHub

Is this still a known issue. I’m seeing this exact issue in the Nextcloud Mail client. I have very few emails in the Inbox, but emails I deleted last night, as well as a few hours ago this morning, are still showing in the Nextcloud email client. If I try to click one, it shows “Not found” in the body area.

  1. I tried ‘r’, and I tried the refresh icon in the NC Mael client. Nothing changed.
  2. I compacted and deleted trash in a different mail client, then did the ‘r’ and refresh icon again in Nextcloud mail. Still showing deleted email in NC Mail client.

Not comfortable messing with the db, or truncating anything, so looking for other possible solutions. I’d love NC to be my overall mail and calendar solution, but need it to work in conjunction with mobile mail clients and other desktop clients properly.

If there is anything else I can provide please let me know.

Using Nextcloud Hub 6 (27.1.3)

Just FYI (not trying to pile-on) I’m having the same issue.

  • NC AIO v7.8.1
  • NC Hub 6 (27.1.4)
  • Ubuntu 22
  • Mail app 3.5.0

“Compacting” the mailboxes in Thunderbird did not work. I deleted the accounts in NC and reinstalled them. All of the ghosts disappeared.

It would be much easier if there was a button to simply clear the cache.

NC is awesome!! All the developers kick ass!! Thank you all.