foxcpp / maddy

✉️ Composable all-in-one mail server.
https://maddy.email
GNU General Public License v3.0
5.16k stars 250 forks source link

Thunderbird does not delete messages on the server #439

Open foxcpp opened 2 years ago

foxcpp commented 2 years ago

Discussed in https://github.com/foxcpp/maddy/discussions/435

Originally posted by **lexesv** January 6, 2022 Hello. I set in Thunderbird Config editor: **mail.imap.expunge_after_delete;true** But messages are still not deleted from the server.
foxcpp commented 2 years ago

@lexesv, could you add io_debug directive to imap block and a global debug in maddy.conf, attempt deleting some messages and post logs content here? Like this:

debug
imap tcp://0.0.0.0:465 ... {
  io_debug
}
lexesv commented 2 years ago
022-01-08T11:15:18.563Z imap: 71 noop
2022-01-08T11:15:18.563Z imap: 71 OK NOOP completed
2022-01-08T11:15:18.617Z imap: 72 UID fetch 1:* (FLAGS)
2022-01-08T11:15:18.617Z [debug] imapsql: ListMessages: resolved seq 1:* true to 1 4294967295   
2022-01-08T11:15:18.618Z [debug] imapsql: scanMessages: scanned 4 [FLAGS UID]   
2022-01-08T11:15:18.618Z imap: * 1 FETCH (FLAGS (\Recent \Seen) UID 4)
2022-01-08T11:15:18.618Z imap: 72 OK UID FETCH completed
2022-01-08T11:15:18.673Z imap: 73 UID fetch 4 (UID RFC822.SIZE FLAGS BODY.PEEK[HEADER.FIELDS (From To Cc Bcc Subject Date Message-ID Priority X-Priority References Newsgroups In-Reply-To Content-Type Reply-To)])
2022-01-08T11:15:18.673Z [debug] imapsql: ListMessages: resolved seq 4 true to 4 4  
2022-01-08T11:15:18.674Z [debug] imapsql: scanMessages: scanned 4 [UID RFC822.SIZE FLAGS BODY.PEEK[HEADER.FIELDS (FROM TO CC BCC SUBJECT DATE MESSAGE-ID PRIORITY X-PRIORITY REFERENCES NEWSGROUPS IN-REPLY-TO CONTENT-TYPE REPLY-TO)]] 
2022-01-08T11:15:18.674Z imap: * 1 FETCH (UID 4 RFC822.SIZE 2796 FLAGS (\Recent \Seen) BODY[HEADER.FIELDS (FROM TO CC BCC SUBJECT DATE MESSAGE-ID PRIORITY X-PRIORITY REFERENCES NEWSGROUPS IN-REPLY-TO CONTENT-TYPE REPLY-TO)] {275}
From: Alex <user@gmail.com>
To: support@domain.com
Subject: Test
Date: Sat, 8 Jan 2022 13:13:54 +0200
Message-Id: <CAN0-9ZNFRKGBU_U_bRRjK=PaRZ8gbLuvmXmbLTC3HpbUyNsCsA@mail.gmail.com>
Content-Type: multipart/alternative; boundary="00000000000013a65005d510358d"

)
2022-01-08T11:15:18.674Z imap: 73 OK UID FETCH completed
2022-01-08T11:15:21.514Z imap: 74 uid store 4 +Flags (\Seen)
2022-01-08T11:15:21.514Z [debug] imapsql: UpdateMessageFlags: resolved 4 to 4 4 true    
2022-01-08T11:15:21.515Z [debug] imapsql: UpdateMessageFlags: emiting 1 flag updates    
2022-01-08T11:15:21.515Z imap: 74 OK UID STORE completed
2022-01-08T11:15:21.515Z imap: * 1 FETCH (FLAGS (\Recent \Seen))
2022-01-08T11:15:23.119Z imap: 75 uid store 4 +Flags (\Seen \Deleted)
2022-01-08T11:15:23.119Z [debug] imapsql: UpdateMessageFlags: resolved 4 to 4 4 true    
2022-01-08T11:15:23.120Z [debug] imapsql: UpdateMessageFlags: emiting 1 flag updates    
2022-01-08T11:15:23.120Z imap: 75 OK UID STORE completed
2022-01-08T11:15:23.120Z imap: * 1 FETCH (FLAGS (\Recent \Seen \Deleted))
foxcpp commented 2 years ago

Hmm, the included log does not show any EXPUNGE commands being executed.

lexesv commented 2 years ago

Folders are created and deleted. But what I have not tried to do is messages are not deleted from the server.

foxcpp commented 2 years ago

In either case, it might be caused by improper IMAP4 implementation. Will need to recheck if it is still happening in 0.6.

cbrake commented 2 years ago

behavior in Thunderbird seems much better now. Before, messages would not get marked as read, and when I would delete messages, some would come back. I don't see any problems in thunderbird with 0.6.1 (binary says v0.6.0, but I assume it has the v0.6.1 changes). Now, its my Android k-9 mail client that is acting up ...

PaddiM8 commented 1 year ago

Not an issue for me on 0.6.2!

lakano commented 1 year ago

I have the same behavior, spent 4 hours to delete old mails but many are come back and I have this kind of logs:

maddy    | imapsql: loaded a large mailbox with 14104 messages, beware of performance issues    
maddy    | imapsql: Expunge (external prepare) []: Expunge (external decrease for deleted): database is locked  {"mbox":"INBOX","mboxId":45,"username":"guillaume@XXX","uid":8} 

I'm using the 7.0.0 in Docker.

May be I had 14104 messages before my cleaning process, currently Thunderbird show me: accountA: 5008 accountB: 48 accountC: 3605 accountD: 176 accountE: 3 accountF: 0 So currently TB count ~9000 messages max

If you have any idea about how to fix this ? May be I should move from sqllite to something else?