16 July 2014

Solving the IMAP synchronization problem

If you're using a mail server like Zimbra, which uses IMAP and synchronizes emails between the server and the local machine, it could get disappointing when you delete an email on your local system (if you're using Thunderbird or Outlook) and you see that the mail got deleted on the server as well, or vice versa.

A smart colleague of mine, Ancelot Mark Pinto (who also happens to be the one who un-knowingly introduced me to Thunderbird), found a way to circumvent this problem.
His simple solution was to create local folders in Thunderbird...

and create a mail filter to move or copy incoming emails to the local folder. Note that moving the email from the folder that Thunderbird synchronizes with the server will be the equivalent of deleting it from the server (but the local copy will still be there in the folder you moved it into).

I improvised on it by also creating a filter which moves outgoing mails to the local folder too. [update: turns out that you'll have to run this filter manually. Moving the files yourself would be faster than opening up the filter and running it]

Of course, you wouldn't have to go through all this trouble if your IMAP based email server has the ability to configure synchronization (unfortunately Zimbra doesn't seem to have this facility).

In Outlook, you can create mail filters by creating a rule (personally, I've found Thunderbird to be far better than Outlook, in terms of usability, mail filters, extensibility via add-ons, themes, search capability and speed. And then there's the advantage of it being free and open source!).

What's special about IMAP?
Out of curiosity, I found that the POP (now POP3) protocol, can be used only from one mail server and all operations you perform on the emails, will be done on your local PC, after you've downloaded the email from the server. 
IMAP on the other hand, can have a single storage location that can be accessed from multiple mail servers. Besides, IMAP allows you to keep all emails on the server and constantly synchronizes the local copies and the server copies (which is why if you use the filter to move emails out of the inbox as I've shown above, IMAP thinks that the file got deleted, and the server copy also gets deleted). IMAP also downloads an email to the local machine completely, only when the User tries to open that particular email.

No comments: