MailCore / mailcore2

MailCore 2 provide a simple and asynchronous API to work with e-mail protocols IMAP, POP and SMTP. The API has been redesigned from ground up.
Other
2.58k stars 623 forks source link

[Suggested Fix] - iCloud sychronization fails because of malformed IMAP response to UID FETCH #1967

Open BasTossings opened 1 year ago

BasTossings commented 1 year ago

Summary

Hi all, I would like to inform the devs that I discovered an iCloud server issue that affects many email clients (including all currently using MailCore2) and causes them to crash or not synchronize properly when used with iCloud IMAP accounts.

For an example of this issue in a client utilizing MailCore2, see The Eternal Sync Bug

Issue description

In short, some messages in iCloud's IMAP reply to an UID FETCH request contain ENVELOPE's that have a Message-ID containing unescaped double quotes. This causes the parser to fault and the fetch command to fail.

This in turn results in some clients crashing or getting stuck in the synchronization process because they keep retrying the UID FETCH and it keeps faling.

Solution

The issue is on Apple's side and should ideally be fixed by them. I've opened an issue with Apple to this end but their track record responding to these is not great.

In the mean while, I implemented a workaround in libetpan, which is used by MailCore2 to communicate with IMAP servers. This workaround should provide a temporary reolsution of the issue until Apple fixes it on their side.

See: https://github.com/dinhvh/libetpan/issues/426

The workaround still needs to be accepted by the people responsible for maintaining libetpan though, and will require that MailCore2 integrates this new version of libetpan and in turn requires email client authors to update their MailCore2 to that version. I hope I can get this going asap.