From 0be109a816836501806fda18116ac66b402a0134 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 24 Jul 2019 17:26:01 +0200 Subject: [PATCH] Added workaround for Zoho IMAP server bug --- app/src/main/java/eu/faircode/email/Core.java | 5 ++++ tools/zoho.log | 27 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 tools/zoho.log diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 07b7a52c90..4f6aac40b9 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -974,6 +974,11 @@ class Core { boolean sync_kept = prefs.getBoolean("sync_kept", true); boolean delete_unseen = prefs.getBoolean("delete_unseen", false); + if (account.host.toLowerCase().contains("imap.zoho")) { + sync_unseen = false; + sync_flagged = false; + } + Log.i(folder.name + " start sync after=" + sync_days + "/" + keep_days + " sync unseen=" + sync_unseen + " flagged=" + sync_flagged + " delete unseen=" + delete_unseen + " kept=" + sync_kept); diff --git a/tools/zoho.log b/tools/zoho.log new file mode 100644 index 0000000000..1c39e4eee3 --- /dev/null +++ b/tools/zoho.log @@ -0,0 +1,27 @@ +There is a bug in the Zoho IMAP server causing all messages to be returned when searching for messages by flag (UNSEEN, FLAGGED, etc), despite specifying a SINCE. + +This causes all messages to be synchronized/downloaded, causing a lot of unnecessary traffic for both the user (inconveniently hitting rate limits as well) and for your servers. + +See attachment for a protocol log demonstrating this rather serious issue. + +The log was captured using imap.zoho.eu + + +07-24 17:07:32.020 26182 27215 I System.out: BG25 SEARCH OR SINCE 23-Jul-2019 (UNSEEN) ALL +07-24 17:07:32.034 26182 27215 I System.out: * SEARCH 1 +07-24 17:07:32.034 26182 27215 I System.out: BG25 OK Success +07-24 17:07:32.035 26182 27214 I System.out: BG26 IDLE +07-24 17:07:32.041 26182 27214 I System.out: + idling +07-24 17:07:32.041 26182 27215 I System.out: DONE +07-24 17:07:32.052 26182 27214 I System.out: BG26 OK IDLE terminated +07-24 17:07:32.053 26182 27215 I System.out: BG27 FETCH 1 (FLAGS UID) +07-24 17:07:32.093 26182 27215 I System.out: * 1 FETCH (FLAGS (\Recent \Seen) UID 3) +07-24 17:07:32.093 26182 27215 I System.out: BG27 OK Success +07-24 17:07:32.093 26182 27214 I System.out: BG28 IDLE +07-24 17:07:32.103 26182 27214 I System.out: + idling +07-24 17:07:32.104 26182 27215 I System.out: DONE +07-24 17:07:32.110 26182 27214 I System.out: BG28 OK IDLE terminated +07-24 17:07:32.110 26182 27215 I System.out: BG29 FETCH 1 (ENVELOPE INTERNALDATE RFC822.SIZE FLAGS BODYSTRUCTURE UID BODY.PEEK[HEADER] RFC822.SIZE INTERNALDATE) +07-24 17:07:32.127 26182 27215 I System.out: * 1 FETCH (FLAGS (\Recent \Seen) INTERNALDATE "08-Jul-2019 23:10:22 +0000" ... redacted + +07-24 17:48:15.563 27990 28576 I System.out: * CAPABILITY IMAP4rev1 UNSELECT CHILDREN XLIST NAMESPACE IDLE MOVE ID AUTH=PLAIN SASL-IR UIDPLUS ESEARCH LIST-EXTENDED LIST-STATUS WITHIN LITERAL- APPENDLIMIT=10485760