What Is IMAP?
Internet Message Access Protocol (IMAP) is one of the two leading e-mail retrieval protocols used on the Internet. The other, Post Office Protocol (POP), was the original mail retrieval protocol and IMAP was released to improve upon the shortcomings of POP. Now, IMAP is used by a number of major web-based mail services to provide e-mail access, Google's GMail service being an example. The major advantage to using IMAP is that the protocol works by reading messages off of the server, instead of downloading them to a single client location like POP does. This lets a user have multiple clients reading the same e-mail account, all while maintaining synchronization across the board. Since IMAP does not require users to download and store the messages locally, you need to use an IMAP downloader such as OfflineIMAP to retrieve, archive, and backup your messages. While there are many "hacks" or workarounds to get the e-mail out of your desktop client, OfflineIMAP actually downloads every e-mail, in every folder, for your entire account. The only trouble is that it runs from the command line and, if you are a Linux novice, can seem a bit daunting.
Download and install OfflineIMAP from your distribution's software repositories. In Debian-based distributions you can use "apt-get"
from the command prompt or use a package manager like Synaptic to search for and install the software. Once installed, you will need to configure the application manually.
Launch a text editor such as Gedit and create a file with this template and replace the values in parenthesis with your account information:
accounts = (Your Account Name)
localrepository = Local
remoterepository = Remote
type = Maildir
localfolders = (Where You Want To Save Your Backup ex. /home/user/backup)
type = IMAP
remotehost = (Your E-mail Server's Hostname or IP Address)
remoteuser = (Your E-mail User Name)
Save the file in your home directory as ".offlineimaprc" before you close the text editor.
Launch a terminal window from the desktop. If you have never used a terminal before, there is one located under the "Accesories" section of your "Applications" menu in Gnome, or Kterm directly from the KDE "System" menu.
Type "offlineimap" and press the "Enter" key to launch the utility. Enter your password when prompted, then wait for the entirety of your IMAP folders to be downloaded locally.
Schedule OfflineIMAP to Run Automatically In the Background
Most IMAP servers assume that a user is going to be accessing them repeatedly, to keep messages synchronized between the server and their local E-mail client. You can add a few additional options to have OfflineIMAP continue to run in the background and synchronize your E-mail locally on an interval.
Under the [general] section add the "maxsyncaccounts = 1" line to only allow a single account to run the synchronziation process at a time.
Under the [Accounts] section for the account you wish to synchronize, add the "autorefresh = 5" and "quick = 10" lines. The first sets up the server to refresh the account every five minutes while the second option tells the system to ignore synchronization for a period of time if there were not any important changes.
Under the [Repository Remote] section add the "keepalive = 60" to attempt to keep the connection alive in between synchronization periods. This will keep you from having to repeatedly enter your account password. Optionally, you can add the "remotepass = password" option under the "remoteuser" portion of the configuration file to store your password in plaintext. However, if other users have access to your system, doing so would be a big security risk.
OfflineIMAP Manual, https://jgoerzen.github.com/offlineimap/manual.html