mkogg.py: Fix 'self.get_mp4_metadata(self, source)'
[blog.git] / posts / OfflineIMAP.mdwn
1 [[!meta  title="OfflineIMAP"]]
2
3 Our internet connection from home is somewhat flaky, and long-running
4 connections are often dropped.  This is not usually a problem, I just
5 make liberal use of [[screen]] when using [[SSH]].  The dropped
6 connections *are* annoying when I'm reading my mail over [IMAP][] with
7 [[mutt]], my prefered mail client.  Mutt caches many changes (marking
8 messages as read, deleting messages, etc.) and only pushes the changes
9 to the remote IMAP server periodically.  If the connection drops
10 before Mutt pushes those changes, your changes get lost, and you have
11 to reconnect and work through the mail again.
12
13 It would be nice if I could work through my mail locally, and use a
14 more robust tool to deal with the networking side of things.  There
15 are a number of tools to accomplish this, including the vernerable
16 [fetchmail][], but I use [OfflineIMAP][] because it allows me to store
17 my mail locally while retaining direct IMAP access if I need it
18 (e.g. using webmail from an internet cafe).
19
20 Install (on [Gentoo][]) with
21
22     # emerge -av net-mail/offlineimap
23
24 If you're running Python >= 2.7.2rc1 you'll need OfflineIMAP >= 6.3.3
25 to avoid problems such as `Unknown IMAP4 command: 'file'`.
26
27 Then create `~/.offlineimaprc` following the provided examples.  To
28 sync my Drexel account with my local machine, I use something like:
29
30     [general]
31     accounts = Drexel
32
33     [Account Drexel]
34     localrepository = DrexelLocal
35     remoterepository = DrexelRemote
36
37     [Repository DrexelLocal]
38     type = Maildir
39     localfolders = ~/mail/drexel
40     sep = /
41
42     [Repository DrexelRemote]
43     type = IMAP
44     ssl = yes
45     remotehost = imap.mail.drexel.edu
46     remoteuser = REDACTED
47     remotepass = REDACTED
48
49 Then run `offlineimap` to start the bidirectional syncronization.
50 With the configuration above, you'll need to drop OfflineIMAP into a
51 `cron` job (or just run it before you want to read your mail, and
52 again after you've made any local changes).
53
54 If you want to run OfflineIMAP continuously as a daemon, take a look
55 at the `autorefresh` configuration option.
56
57 [IMAP]: http://en.wikipedia.org/wiki/Internet_Message_Access_Protocol
58 [fetchmail]: http://www.fetchmail.info/
59 [offlineimap]: https://github.com/nicolas33/offlineimap
60 [Gentoo]: http://www.gentoo.org/