login about faq

This is more of a conceptual question.

When working with IMAP I want to be able to have an "offline version" (local copy). I also probably want to do all of the organizing of messages, folders etc locally and eventually "sync" with the server. There must be a standard way of dealing with this in IMAP.


asked Dec 29 '12 at 14:24

JackP's gravatar image



Unfortunately, there isn't a standard way of doing what you described. Your app would need to select each folder one-by-one, get a list of local UID's and compare it with the UID's on the server, and then decide which emails to download, upload, or delete, depending on what behavior you desire.


answered Dec 31 '12 at 10:19

chilkat's gravatar image

chilkat ♦♦

Thanks for your reply, thought you might say that.

Since I havent really worked with IMAP before please tell me if this would be the correct approach:

I am going to create a local database file that mirrors the folder structure on the server (ie inbox.db) the DB will store the UID of the folder, and the UIDs, subject and body of all previously sync messages in that folder. While this local DB is displayed to the user and the user is working with it, I will download in the background FetchBundle ALL messages in the current folder. I will then update the server with any DB changes and vice-versa using the bundle as my reference. Also when the user changes folders or logs out, I will update the current folder with any changes to either side.

Assuming above is the best approach, then is there a function, or how do I tell if there has been an update to the server since I last cached the bundle?

Also, is there a full offline copy of the ActiveX reference for IMAP I can download (objects, properties, etc)?


answered Jan 01 '13 at 11:48

JackP's gravatar image



You will also need to check UIDValidity for each IMAP mailbox. If UIDValidity changes (it is a 32-bit number), then all server uids should be considered invalid.


answered Jan 03 '13 at 04:00

Krisb's gravatar image


Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Dec 29 '12 at 14:24

Seen: 1,255 times

Last updated: Jan 03 '13 at 04:00

powered by OSQA