libremail
libremail copied to clipboard
Sync should only download subscribed folders (LSUB)
Describe the bug As we discuss in https://github.com/mikegioia/libremail/issues/105 there is a problem with syncing Exchange mailboxes. There are many clients of Microsoft Office365 mail system, and I think it is important. Problem occurs when we sync folders like "Archive" e.t.c.
To Reproduce Steps to reproduce the behavior:
- Add Microsoft Office365 mail account.
- Try to sync it
- See errors
[19-Mar-20 11:54:04] DEBUG: No messages to delete in Archive
[19-Mar-20 11:54:04] ERROR: cannot read - connection closed?
Also when we try to sync folder "Calendar/United States holidays" in database added this messages:
**Message.subject**
Retrieval using the IMAP4 protocol failed for the following message: 367
**Message.text_plain**
The server couldn't retrieve the following message:
Subject: "Juneteenth"
From: "xxxx" ("/O=EXCHANGELABS/OU=EXCHANGE ADMINISTRATIVE GROUP (FYDIBOHF23SPDLT)/CN=RECIPIENTS/CN=D6FFC709A0FE4E2F8AD251C6DE637AAD-ADMIN")
Sent date: 9/21/2019 9:00:25 PM
Expected behavior Correctly folders sync.
Possible solution As we decide it should be mechanism to per-account select folders to sync. And this mechanism already exists - it is "folder subscriptions". But it has one disadvantage. Folders "INBOX" and "Outbox" by default are unsubscribed and Outlook client synced it ignoring subscriptions.
So we need to set mandatory_sync_folders parameter somewhere (for example in default.ini / local.ini). It also needed parameter sync_only_subscribed_folders, which will be regulate behavior of this functionality. Default sync_only_subscribed_folders = false for current behavior.
Requirements I have already done some work with required libraries. You just need to review it :)
- https://github.com/ParticleBits/zend-mail/pull/5 (to develop branch)
- https://github.com/ParticleBits/imap/pull/4 (to master branch)
I finish this work @mikegioia Please review my pull request https://github.com/mikegioia/libremail/pull/121