Closed tetsumaki closed 7 months ago
Facing the same issue with foxcpp/maddy:0.6.2
.
I am migrating from Mailu to Maddy and some emails were displayed correctly. From 6,5k only 22 were listed and I couldn't find anything blatant.
Here's IMAP query made by RainLoop:
[22:09:23.028][ccb98281] IMAP[NOTE]: Start connection to "ssl://mail.(redacted):993"
[22:09:23.042][ccb98281] IMAP[NOTE]: Connected (success)
[22:09:23.042][ccb98281] IMAP[DATA]: < * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR CHILDREN UNSELECT MOVE IDLE APPENDLIMIT AUTH=PLAIN AUTH=LOGIN COMPRESS] IMAP4rev1 Service Ready\r\n
[22:09:23.042][ccb98281] IMAP[DATA]: > TAG1 AUTHENTICATE PLAIN\r\n
[22:09:23.042][ccb98281] IMAP[DATA]: < +\r\n
[22:09:23.042][ccb98281] IMAP[SECURE]: > *******\r\n
[22:09:23.094][ccb98281] IMAP[DATA]: < TAG1 OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR CHILDREN UNSELECT MOVE IDLE APPENDLIMIT I18NLEVEL=1 SORT THREAD=ORDEREDSUBJECT COMPRESS NAMESPACE] AUTHENTICATE completed\r\n
[22:09:23.095][ccb98281] IMAP[DATA]: > TAG2 SELECT "INBOX"\r\n
[22:09:23.106][ccb98281] IMAP[DATA]: < * FLAGS (\Seen \Answered \Flagged \Deleted \Draft)\r\n
[22:09:23.106][ccb98281] IMAP[DATA]: < * OK [PERMANENTFLAGS (\Seen \Answered \Flagged \Deleted \Draft \*)] Flags permitted.\r\n
[22:09:23.106][ccb98281] IMAP[DATA]: < * OK [UNSEEN 1] Message 1 is first unseen\r\n
[22:09:23.106][ccb98281] IMAP[DATA]: < * 6593 EXISTS\r\n
[22:09:23.106][ccb98281] IMAP[DATA]: < * 0 RECENT\r\n
[22:09:23.106][ccb98281] IMAP[DATA]: < * OK [UIDNEXT 6594] Predicted next UID\r\n
[22:09:23.106][ccb98281] IMAP[DATA]: < * OK [UIDVALIDITY 2966996583] UIDs valid\r\n
[22:09:23.106][ccb98281] IMAP[DATA]: < TAG2 OK [READ-WRITE] SELECT completed\r\n
[22:09:23.107][ccb98281] IMAP[DATA]: > TAG3 CAPABILITY\r\n
[22:09:23.107][ccb98281] IMAP[DATA]: < * CAPABILITY IMAP4rev1 LITERAL+ SASL-IR CHILDREN UNSELECT MOVE IDLE APPENDLIMIT I18NLEVEL=1 SORT THREAD=ORDEREDSUBJECT COMPRESS NAMESPACE\r\n
[22:09:23.107][ccb98281] IMAP[DATA]: < TAG3 OK CAPABILITY completed\r\n
[22:09:23.107][ccb98281] IMAP[DATA]: > TAG4 STATUS "INBOX" (MESSAGES UNSEEN UIDNEXT)\r\n
[22:09:23.108][ccb98281] IMAP[DATA]: < * STATUS INBOX (UIDNEXT 6594 MESSAGES 6593 UNSEEN 6571)\r\n
[22:09:23.108][ccb98281] IMAP[DATA]: < TAG4 OK STATUS completed\r\n
[22:09:23.108][ccb98281] INFO[DATA]: Get Serialized UIDS from cache ("INBOX" / UNDELETED) [count:22]
[22:09:23.108][ccb98281] INFO[DATA]: ThreadsMapSorted/ALL/Limit=50/INBOX/3eedf1a29937afce36227da926d32a73
[22:09:23.108][ccb98281] INFO[DATA]: Get Serialized Thread UIDS from cache ("INBOX" / ALL) [count:17]
[22:09:23.109][ccb98281] IMAP[DATA]: > TAG5 UID FETCH 2259,1984,1775,1457,934,2720,6461,4294,2742,3293,2534,4351,2691,5362,2692,6435,2698 (UID RFC822.SIZE INTERNALDATE FLAGS BODYSTRUCTURE BODY.PEEK[HEADER.FIELDS (RETURN-PATH RECEIVED MIME-VERSION MESSAGE-ID CONTENT-TYPE FROM TO CC BCC SENDER REPLY-TO DELIVERED-TO IN-REPLY-TO REFERENCES DATE SUBJECT SENSITIVITY X-MSMAIL-PRIORITY IMPORTANCE X-PRIORITY X-DRAFT-INFO RETURN-RECEIPT-TO DISPOSITION-NOTIFICATION-TO X-CONFIRM-READING-TO AUTHENTICATION-RESULTS X-DKIM-AUTHENTICATION-RESULTS LIST-UNSUBSCRIBE)])\r\n
Seems like SEARCH UNDELETED
may be returning incomplete results. Not sure why that might be the case, I will take a look at it in the following days.
@foxcpp I think I've found out what is causing the issue, at least for my case. My emails were migrated through imapsync
and for some unknown reason unread emails aren't being flagged at all. That explains why some emails appeared and others don't.
Considering they aren't being flagged and SEARCH UNDELETED
refers to flags
table - that don't even know about the not flagged messages - it won't list anything.
Here's a query example:
SELECT DISTINCT flags.msgId
FROM flags
WHERE mboxId = $1
AND flags.msgId NOT IN (
SELECT DISTINCT flags.msgId
FROM flags
WHERE mboxId = $2
AND flag = $3
(fwiw: UNDELETED
is properly passing the right parameters to the second query: search stmt args: [5 5 \Deleted]
)
My workaround was to manually add messages to flags
table.
Any particular reason we rely on flags
table rather msgs
in the first query, Max?
Adding to the above, another way to fix it is to slightly change the above query - formatted at go-imap-sql
- to something like this:
SELECT DISTINCT msgs.msgId
FROM msgs
WHERE mboxId = $1
AND msgs.msgId NOT IN (
SELECT DISTINCT flags.msgId
FROM flags
WHERE mboxId = $2
AND flag = $3)
@foxcpp if you are okay with it I can create the PR and create test scenarios to catch it in the future.
@foxcpp if you are okay with it I can create the PR and create test scenarios to catch it in the future.
Yeah, that would be appreciated.
Any particular reason we rely on flags table rather msgs in the first query, Max?
Mostly an oversight. Before go-imap v2 migration, all messages had at least \Recent
flag and that flag is immutable per IMAP4 spec so it worked fine.
I'm on Madddy 0.7.0 (image 4a1b....fe52), and appear still to be seeing this:
https://github.com/the-djmaze/snappymail/issues/1515
More logs on that issue but let me know if I can provide anyhting.
Cheers
Describe the bug
Hello, emails are not displayed in RainLoop. We can see that RainLoop detects the email (1) in the column, but it is not visible. I have no problem with K-9 Mail.
Steps to reproduce
I use the latest version of RainLoop: 1.17.0 Just click on
Inbox
and see that nothing appears.Log files
I use the default docker configuration with very few changes.
Log from RainLoop when i click on
Inbox
:And no problem from K-9 Mail when i refresh the Inbox folder :
RainLoop screenshot :
Configuration file
Environment information
Alpine Linux 3.16.2 Podman 4.1.0