Overview: The Nextcloud mail app keeps a cache of email data in the Nextcloud SQL database. If server-side cleanup scripts on the IMAP server are used to purge old messages from user Trash or Junk folders, it is observed that Nextcloud gets out of sync with the IMAP server and these deleted messages remain in the mail app Trash/Junk folder message list. Selecting one of these messages displays "not found" in the message detail panel. Steps to Reproduce: Purge old messages from a user's Trash folder by server-side script. For example, with Cyrus-IMAP: ipurge -d 365 -f user/jsmith/Trash to remove deleted messages older than 1 year. Login to Nextcloud, open the mail app and select the Trash folder. Actual Results: Messages older than 1 year still appear in the Trash folder message list. Selecting one shows "not found" in the message detail panel. Expected Results: Nextcloud folders should sync to the IMAP server. Messages older than 1 year should be gone from the Trash folder message list. Additional Information: 1. Selecting the 3 dots next to the Trash/Junk folder shows the correct message count, even though the message list is wrong. 2. Attempting to delete these "ghost" messages in the Nextcloud mail app produces an error. 3. Attempts to correct this with occ "mail:clean-up" or "mail:account:sync" commands were unsuccessful. 4. The only methods of recovery are: a) From the Nextcloud mail app, select the 3 dots next to the folder and "clear mailbox" to empty all its contents. b) Write SQL queries to manually delete the ghost messages from the Nextcloud database mail tables. The Nextcloud mail app behaviour is fundamentally wrong. The IMAP server is the master and one source of truth, NOT the Nextcloud database. Software Versions: FreeBSD version is 13.2-p4. The Nextcloud software installed is: nextcloud-php82 27.1.0 nextcloud-calendar-php82 4.5.1 nextcloud-contacts-php82 5.4.2 nextcloud-mail-php82 3.4.0 nextcloud-notes-php82 4.8.1
^Triage: fix port, assigned to maintainer (committer).