Search code examples
c++delphivbaimap

How do mail programs display the list of messages so fast when they start up?


I am working on an IMAP client application that connects to the mail server and loads the message headers into a list view.

In my application, it takes a long time to load. I've set it to connect and load the messages when I start the application.

I see that when other e-mail clients using IMAP load, all of messages are there instantly, even if there are 500 messages in the list.

How do they do it? Do they actually save the last list before the application was closed? Some other way?


Solution

  • Yes, email client apps usually cache downloaded messages locally for performance and then resync with the server periodically to resolve changes performed over time. In the case of IMAP, it can notify clients in real-time when emails are added/deleted/moved (Indy's TIdIMAP4 does not support that functionality yet, though), but you would have to resync manually at startup to account for changes that occurred while your app was not running.