Bug 275649 - mail/nextcloud-mail: Nextcloud mail retains messages deleted from IMAP server
Summary: mail/nextcloud-mail: Nextcloud mail retains messages deleted from IMAP server
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Bernard Spil
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-09 06:10 UTC by LloydSystems
Modified: 2024-08-25 19:17 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description LloydSystems 2023-12-09 06:10:01 UTC
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
Comment 1 Zsolt Udvari freebsd_committer freebsd_triage 2024-08-25 19:17:50 UTC
^Triage: fix port, assigned to maintainer (committer).