The official version of Modest only caches an email for offline reading once it has been opened and viewed. These modified packages instead download all mail in a folder whenever the folder is opened and viewed. This makes it practical to cache large amounts of email in one hit and then work through the email later, without requiring an internet connection.
To install the packages, first add my catalogue to the application manager:
Then on the command line, as root, "apt-get install modest". I tried to figure out how to put just the modest update in a .install file, and failed. Sorry. My attempt is here.
Offline IMAP support is enabled at the account level (not the folder level). A new checkbox is available at the bottom of the advanced settings panel. I haven't provided a translation yet, so it's just labelled "mcenfladvsetupofflinesync":
Only previously-unseen messages will be synchronised. If you switch on offline IMAP support in an existing account, only new emails will start to be downloaded. If you want to download all the existing emails, the easiest way is to shut down Modest (preferably by restarting the machine), remove the folder's cache directory by hand, and start Modest. The cache directory is in:
/home/user/.modest/cache/mail/imap/Account Name/folders/Folder Name
There is no completion notification or progress meter, it's done when it's done. You can start browsing email immediately though.
Here is the patch for Modest. It just adds the configuration item and associated gconf value, and ensures that this is passed down to Tinymail:
Also required is a patch for Camel Lite in Tinymail. Offline IMAP support was supported by Camel since before the Tinymail fork. However, it's been broken for reasons I haven't been able to figure out. This tiny patch fixes it. I've submitted a bug report for this, but so far haven't had any response.