Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


My problem: I want to read email offline with my choice of client (mutt), but I want actions like moving emails, etc. to be kept in two-way snc with an imap server.

My question: Is there a straightforward way to do this while still using standard tools like fetchmail, procmail, etc.?


I have a gmail account. For various reasons - some institutional - I need to be able to read this mail from a mail client; I want my 'inbox' to be clean, much like I would keep it with a traditional local mail setup, and for anything I 'archive' to be searchable. If I move an email to a folder in the web client, I'd like my local inbox to take this into account.

When possible, I want to be able to read this mail from mutt. Previously I used mutt's native imap functionality, but mutt has to make a connection to the server each time you run it; the connection often drops while I'm reading mail and mutt is open in the background; it only keeps a cache of message headers, and loading new messages requires a round-trip to the server; if I send a message, I have to wait for it to be acknowledged over STMP before I can look at any other messages.

Is there some way around this? I don't consider fat clients like Thunderbird to be a solution: I require terminal access, I like to be able to grep my mail, I make good use of procmail's filtering capabilities, and I prefer decoupled systems.

As mentioned above, fetchmail, procmail and sendmail get me almost there - but not quite to being able to keep my activity in sync between clients.

Am I missing something? I've looked at the FreeBSD handbook's section on email and a bunch of blog posts but nothing seems to bring it all together in this way.

By the way, I run Arch Linux and Debian.

share|improve this question
Have you considered offlineimap or isync? They both work well... – jasonwryan Apr 14 '13 at 6:20
Just to help out @jasonwryan's comment: offlineimap.org & isync.sourceforge.net – slm Apr 14 '13 at 21:28
Thanks. I found isync, now named absync. It's working well! – Cerales Apr 14 '13 at 23:30

OfflineIMAP and isync are both programs that integrate well with mutt and will satisfy your other criteria.

OfflineIMAP is written in Python and isync in C; both are very quick.

Both programs are well documented and straightforward to set up; isync perhaps slightly easier.

There is one significant difference between the functionality of each that is worth bearing in mind: you can use mbsync (isync's executable) to repopulate a remote IMAP maildir1 from a local copy, OfflineIMAP cannot do this. [Amendment: from v6.4.0, OfflineIMAP has the createfolders option to create folders on the remote repository].

The Arch Wiki has pages on both, with example configurations and use cases.2

1. In the event, hypothetically, you inadvertently delete your remote mail store and need to recover from a backup on a local machine...
2. isync and OfflineIMAP.

share|improve this answer
I second the isync/mbsync idea. OfflineImap is not reliable enough for me with my Gmail account (I'm subscribed to several high-traffic mailing lists and OfflineImap was getting stuck very often). – Serge Broslavsky Jun 8 '14 at 19:34
The stated difference does not seem to hold true anymore (for OfflineIMAP, see: createfolder) ? – Nikos Alexandris Apr 5 '15 at 16:39
@NikosAlexandris Yes: this was introduced in 6.4.0. I'll update my answer, thanks for the prompt. – jasonwryan Apr 5 '15 at 18:55
On-Off topic: another difference is that mbsync can't handle UTF8 stuff, while there is a Python solution for offlineimap (see Greek characters in mutt's sidebar for example. Wish mbsync could do it, or I'll try to offer a Python based solution for it as well, if possible. OfflineIMAP's give's me problems lately (UID validity related, as well as creating duplicate messages once I remove the readonly = true option. – Nikos Alexandris Apr 5 '15 at 20:58

Maybe the following http://stevelosh.com/blog/2012/10/the-homely-mutt/#getting-email excellently written post from Steve Losh will help you

share|improve this answer
It would be better to repeat the relevant parts of the information the link provides here and use the link as a reference for more detail. That way your answer stays useful even if the link goes away at some point. – Anthon May 19 '13 at 6:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.