Fast Convenient Mail for Travel: OfflineIMAP

Linux laptop users, try the mail solution that combines the advantages of fast local mail folders and a server-based IMAP repository.

E-mail is for many people the single-most important feature of the Internet. We read e-mail at home, at work, while traveling and on many different computers. But it's difficult to see the same mail from all of those places. If you delete a message from home, it may not show up as deleted when you look at the same account from work. Worse, you might be able to view a given message on only one machine. And if you sometimes want to download mail to your laptop and read it without any Internet connection, things get even more complex.

Some people try to solve these problems by using IMAP in their mail clients. But IMAP can be slow and poorly supported; especially on a slow connection, it tends to make mail reading unpleasant. I recently faced exactly this situation—I was a very annoyed programmer. Many programs come about because a programmer somewhere was annoyed. Thus, I wrote OfflineIMAP.

About OfflineIMAP

OfflineIMAP is designed to let you read the same mailbox from many different computers, with or without an active Internet connection. It performs a bi-directional sync, which means that any changes you make eventually are reflected on all your machines. In its most common form, OfflineIMAP works by connecting to an IMAP server and synchronizing your folders to a series of Maildir folders on your local machine. Despite its name, OfflineIMAP is useful even if you never read mail off-line.

Installing OfflineIMAP

OfflineIMAP installation is easy. Visit the OfflineIMAP home page at, and download the .deb or the tar.gz file. Debian users simply can run dpkg -i offlineimap.deb to install it, and then use apt-get -f install to fix any missing dependencies. If you're not running Debian, make sure you have Python 2.2 or above installed. If you do not have Python already, check with your distribution or visit to download it.

When you're ready to install OfflineIMAP, run tar -zxvf offlineimap_4.0.2.tar.gz to unpack the source. Change into the new directory and then, as root, run python install. If you get stuck, the OfflineIMAP manual contains some more installation hints.

Basic Configuration

OfflineIMAP configuration is done in the ~/.offlineimaprc file. That file has three different sections: general, which controls overall behavior of OfflineIMAP; repository, which describes a place where mail is stored; and account, which describes how two repositories are synchronized together. A basic, simple setup requires only a small configuration file. Here is an example:

accounts = MyMail

[Account MyMail]
localrepository = MyMailLocal
remoterepository = MyMailRemote

[Repository MyMailLocal]
type = Maildir
localfolders = ~/MyMail

[Repository MyMailRemote]
type = IMAP
remotehost =
remoteuser = my-username-goes-here
ssl = yes

This example defines one account, MyMail. The MyMail account is synchronized from the server to the ~/MyMail directory on your local machine. All remote folders are copied. If your IMAP provider does not support SSL encryption, delete the ssl = yes line. Now, run offlineimap. You are asked for your password, and then it synchronizes your mailboxes once and exits.

Continuous Synchronization

If you're connected to the Internet while you read your mail, you can have OfflineIMAP continually keep your local tree synced up with the server. To do this, simply add an autorefresh line to your account section. For instance, you might modify your account section to look like this:

[Account MyMail]
localrepository = MyMailLocal
remoterepository = MyMailRemote
autorefresh = 5

When you run OfflineIMAP now, it synchronizes your mailbox like before. But when it's done, instead of exiting, it keeps running, synchronizing your mail every five minutes.

Synchronizing Multiple Accounts

OfflineIMAP is quite capable of synchronizing multiple accounts. For instance, you might want to be able to read mail from both your work e-mail and your home e-mail. To do this, add one account and two repository sections for each account, making sure to use unique names. Then, add the account to the accounts list in the general section. Separate the names by commas.

On the local side, you should make sure that each account synchronizes into a different directory. Otherwise, confusion and corruption may occur.



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.


Gurkha Encounters's picture

I guess there is booming the Performance and method for travel and tourism

Thank you


Suba Sagar Malla's picture

I guess there would be such fast methods for Travel as well.

subscribed folders

Anonymous's picture

I am curious if OfflineIMAP can be set to only synchronize IMAP folders which are marked as subscribed. While reading the section marked "Selecting Folders" it seemed natural to have an option regarding IMAP subscriptions, which could, in most cases, circumvent the need for writing a special callback function in python.

One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix