2013-04-20 00:28:17 +02:00
|
|
|
OfflineImap
|
|
|
|
===========
|
2011-01-15 16:48:30 +01:00
|
|
|
|
|
|
|
Description
|
2012-02-24 14:46:14 +01:00
|
|
|
-----------
|
2011-01-15 16:48:30 +01:00
|
|
|
|
|
|
|
OfflineIMAP is a tool to simplify your e-mail reading. With OfflineIMAP, you can
|
|
|
|
read the same mailbox from multiple computers. You get a current copy of your
|
|
|
|
messages on each computer, and changes you make one place will be visible on all
|
|
|
|
other systems. For instance, you can delete a message on your home computer, and
|
|
|
|
it will appear deleted on your work computer as well. OfflineIMAP is also useful
|
|
|
|
if you want to use a mail reader that does not have IMAP support, has poor IMAP
|
2012-07-23 18:05:46 +02:00
|
|
|
support, or does not provide disconnected operation. It's homepage at
|
|
|
|
http://offlineimap.org contains more information, source code, and online
|
|
|
|
documentation.
|
2011-01-15 16:48:30 +01:00
|
|
|
|
2012-02-24 14:46:14 +01:00
|
|
|
OfflineIMAP does not require additional python dependencies beyond python >=2.6
|
|
|
|
(although python-sqlite is strongly recommended).
|
2011-01-15 16:48:30 +01:00
|
|
|
|
|
|
|
OfflineIMAP is a Free Software project licensed under the GNU General Public
|
2012-02-24 14:46:14 +01:00
|
|
|
License version 2 (or later). You can download it for free, and you can modify
|
|
|
|
it. In fact, you are encouraged to contribute to OfflineIMAP.
|
2011-01-15 16:48:30 +01:00
|
|
|
|
2012-02-24 11:13:27 +01:00
|
|
|
Documentation
|
2012-02-24 14:46:14 +01:00
|
|
|
-------------
|
2012-02-24 11:13:27 +01:00
|
|
|
|
2013-04-20 00:28:17 +02:00
|
|
|
The documentation is included (in .rst format) in the `docs` directory.
|
|
|
|
Read it directly or generate nice html docs (python-sphinx needed) and/or
|
|
|
|
the man page (python-docutils needed) while being in the `docs` dir via:
|
2011-01-15 16:48:30 +01:00
|
|
|
|
2012-02-24 11:13:27 +01:00
|
|
|
'make doc' (user docs), 'make man' (man page only) or 'make' (both)
|
2011-01-15 16:48:30 +01:00
|
|
|
|
2012-02-24 11:13:27 +01:00
|
|
|
(`make html` will simply create html versions of all *.rst files in /docs)
|
|
|
|
|
|
|
|
The resulting user documentation will be in `docs/html`. The full user
|
2012-02-24 14:46:14 +01:00
|
|
|
docs are also at: http://docs.offlineimap.org. Please see there for
|
2012-02-24 11:13:27 +01:00
|
|
|
detailed information on how to install and configure OfflineImap.
|
2011-01-15 16:48:30 +01:00
|
|
|
|
|
|
|
Quick Start
|
|
|
|
===========
|
|
|
|
|
2012-02-24 11:13:27 +01:00
|
|
|
First, install OfflineIMAP. See docs/INSTALL.rst or read
|
2013-04-20 00:28:17 +02:00
|
|
|
http://docs.offlineimap.org/en/latest/INSTALL.html.
|
2012-02-24 11:13:27 +01:00
|
|
|
(hint: `sudo python setup.py install`)
|
2011-01-15 16:48:30 +01:00
|
|
|
|
2012-02-24 11:13:27 +01:00
|
|
|
Second, set up your configuration file and run it! The distribution
|
|
|
|
includes offlineimap.conf.minimal (Debian users may find this at
|
|
|
|
``/usr/share/doc/offlineimap/examples/offlineimap.conf.minimal``) that
|
|
|
|
provides you with the bare minimum of setting up OfflineIMAP. You can
|
|
|
|
simply copy this file into your home directory and name it
|
|
|
|
``.offlineimaprc``. A command such as ``cp offlineimap.conf.minimal
|
|
|
|
~/.offlineimaprc`` will do it. Or, if you prefer, you can just copy
|
2013-04-20 00:28:17 +02:00
|
|
|
this text to ``~/.offlineimaprc``:
|
2011-01-15 16:48:30 +01:00
|
|
|
|
2013-04-20 00:28:17 +02:00
|
|
|
[general]
|
|
|
|
accounts = Test
|
2011-01-15 16:48:30 +01:00
|
|
|
|
2013-04-20 00:28:17 +02:00
|
|
|
[Account Test]
|
|
|
|
localrepository = Local
|
|
|
|
remoterepository = Remote
|
2011-01-15 16:48:30 +01:00
|
|
|
|
2013-04-20 00:28:17 +02:00
|
|
|
[Repository Local]
|
|
|
|
type = Maildir
|
|
|
|
localfolders = ~/Test
|
2011-01-15 16:48:30 +01:00
|
|
|
|
2013-04-20 00:28:17 +02:00
|
|
|
[Repository Remote]
|
|
|
|
type = IMAP
|
|
|
|
remotehost = examplehost
|
|
|
|
remoteuser = jgoerzen
|
2011-01-15 16:48:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
Now, edit the ``~/.offlineimaprc`` file with your favorite editor. All you have
|
|
|
|
to do is specify a directory for your folders to be in (on the localfolders
|
|
|
|
line), the host name of your IMAP server (on the remotehost line), and your
|
|
|
|
login name on the remote (on the remoteuser line). That's it!
|
|
|
|
|
2012-02-24 11:13:27 +01:00
|
|
|
To run OfflineIMAP, you just have to say `offlineimap` ― it will fire
|
2012-02-24 14:46:14 +01:00
|
|
|
up, ask you for a login password if necessary, synchronize your folders,
|
|
|
|
and exit. See?
|
2011-01-15 16:48:30 +01:00
|
|
|
|
2012-02-24 14:46:14 +01:00
|
|
|
You can just throw away the rest of the finely-crafted, perfectly-honed user
|
2013-04-20 00:28:17 +02:00
|
|
|
manual! Of course, if you want to see how you can make OfflineIMAP
|
2012-02-24 14:46:14 +01:00
|
|
|
FIVE TIMES FASTER FOR JUST $19.95 (err, well, $0), you have to read on our
|
2013-04-20 00:28:17 +02:00
|
|
|
full user documentation and peruse the sample offlineimap.conf (which
|
2012-02-24 14:46:14 +01:00
|
|
|
includes all available options) for further tweaks!
|
2011-01-15 16:48:30 +01:00
|
|
|
|
|
|
|
|
2012-02-24 14:46:14 +01:00
|
|
|
Mailing list & bug reporting
|
|
|
|
----------------------------
|
2011-01-15 16:48:30 +01:00
|
|
|
|
|
|
|
The user discussion, development and all exciting stuff take place in the
|
2012-07-23 18:05:46 +02:00
|
|
|
OfflineImap mailing list at
|
|
|
|
http://lists.alioth.debian.org/mailman/listinfo/offlineimap-project. You do not
|
|
|
|
need to subscribe to send emails.
|
2011-01-15 16:48:30 +01:00
|
|
|
|
2012-07-23 18:03:43 +02:00
|
|
|
Bugs, issues and contributions should be reported to the mailing list. Bugs can
|
|
|
|
also be reported in the issue tracker at
|
|
|
|
https://github.com/OfflineIMAP/offlineimap/issues.
|
2011-01-15 16:48:30 +01:00
|
|
|
|
2012-02-24 14:46:14 +01:00
|
|
|
Configuration Examples
|
|
|
|
======================
|
2011-01-15 16:48:30 +01:00
|
|
|
|
|
|
|
Here are some example configurations for various situations. Please e-mail any
|
|
|
|
other examples you have that may be useful to me.
|
|
|
|
|
|
|
|
|
|
|
|
Multiple Accounts with Mutt
|
2012-02-24 14:46:14 +01:00
|
|
|
---------------------------
|
2011-01-15 16:48:30 +01:00
|
|
|
|
|
|
|
This example shows you how to set up OfflineIMAP to synchronize multiple
|
|
|
|
accounts with the mutt mail reader.
|
|
|
|
|
|
|
|
Start by creating a directory to hold your folders by running ``mkdir ~/Mail``.
|
2013-04-20 00:28:17 +02:00
|
|
|
Then, in your ``~/.offlineimaprc``, specify:
|
2011-01-15 16:48:30 +01:00
|
|
|
|
2013-04-20 00:28:17 +02:00
|
|
|
accounts = Personal, Work
|
2011-01-15 16:48:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
Make sure that you have both an [Account Personal] and an [Account Work]
|
|
|
|
section. The local repository for each account must have different localfolder
|
|
|
|
path names. Also, make sure to enable [mbnames].
|
|
|
|
|
2013-04-20 00:28:17 +02:00
|
|
|
In each local repository section, write something like this:
|
2011-01-15 16:48:30 +01:00
|
|
|
|
2013-04-20 00:28:17 +02:00
|
|
|
localfolders = ~/Mail/Personal
|
2011-01-15 16:48:30 +01:00
|
|
|
|
|
|
|
|
2013-04-20 00:28:17 +02:00
|
|
|
Finally, add these lines to your ``~/.muttrc``:
|
2011-01-15 16:48:30 +01:00
|
|
|
|
2013-04-20 00:28:17 +02:00
|
|
|
source ~/path-to-mbnames-muttrc-mailboxes
|
|
|
|
folder-hook Personal set from="youremail@personal.com"
|
|
|
|
folder-hook Work set from="youremail@work.com"
|
|
|
|
set mbox_type=Maildir
|
|
|
|
set folder=$HOME/Mail
|
|
|
|
spoolfile=+Personal/INBOX
|
2011-01-15 16:48:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
That's it!
|
|
|
|
|
|
|
|
|
|
|
|
UW-IMAPD and References
|
2012-02-24 14:46:14 +01:00
|
|
|
-----------------------
|
2011-01-15 16:48:30 +01:00
|
|
|
|
|
|
|
Some users with a UW-IMAPD server need to use OfflineIMAP's "reference" feature
|
|
|
|
to get at their mailboxes, specifying a reference of ``~/Mail`` or ``#mh/``
|
|
|
|
depending on the configuration. The below configuration from (originally from
|
|
|
|
docwhat@gerf.org) shows using a reference of Mail, a nametrans that strips the
|
|
|
|
leading Mail/ off incoming folder names, and a folderfilter that limits the
|
2013-04-20 00:28:17 +02:00
|
|
|
folders synced to just three:
|
|
|
|
|
|
|
|
[Account Gerf]
|
|
|
|
localrepository = GerfLocal
|
|
|
|
remoterepository = GerfRemote
|
|
|
|
|
|
|
|
[Repository GerfLocal]
|
|
|
|
type = Maildir
|
|
|
|
localfolders = ~/Mail
|
|
|
|
|
|
|
|
[Repository GerfRemote]
|
|
|
|
type = IMAP
|
|
|
|
remotehost = gerf.org
|
|
|
|
ssl = yes
|
|
|
|
remoteuser = docwhat
|
|
|
|
reference = Mail
|
|
|
|
# Trims off the preceeding Mail on all the folder names.
|
|
|
|
nametrans = lambda foldername: \
|
2011-01-15 16:48:30 +01:00
|
|
|
re.sub('^Mail/', '', foldername)
|
2013-04-20 00:28:17 +02:00
|
|
|
# Yeah, you have to mention the Mail dir, even though it
|
|
|
|
# would seem intuitive that reference would trim it.
|
|
|
|
folderfilter = lambda foldername: foldername in [
|
2011-01-15 16:48:30 +01:00
|
|
|
'Mail/INBOX',
|
|
|
|
'Mail/list/zaurus-general',
|
|
|
|
'Mail/list/zaurus-dev',
|
2013-04-20 00:28:17 +02:00
|
|
|
]
|
|
|
|
maxconnections = 1
|
|
|
|
holdconnectionopen = no
|
2011-01-15 16:48:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
pythonfile Configuration File Option
|
2012-02-24 14:46:14 +01:00
|
|
|
-------------------------------------
|
2011-01-15 16:48:30 +01:00
|
|
|
|
|
|
|
You can have OfflineIMAP load up a Python file before evaluating the
|
|
|
|
configuration file options that are Python expressions. This example is based
|
|
|
|
on one supplied by Tommi Virtanen for this feature.
|
|
|
|
|
|
|
|
|
2013-04-20 00:28:17 +02:00
|
|
|
In ~/.offlineimaprc, he adds these options:
|
2011-01-15 16:48:30 +01:00
|
|
|
|
2013-04-20 00:28:17 +02:00
|
|
|
[general]
|
|
|
|
pythonfile=~/.offlineimap.py
|
|
|
|
[Repository foo]
|
|
|
|
foldersort=mycmp
|
2011-01-15 16:48:30 +01:00
|
|
|
|
2013-04-20 00:28:17 +02:00
|
|
|
Then, the ~/.offlineimap.py file will contain:
|
2011-01-15 16:48:30 +01:00
|
|
|
|
|
|
|
prioritized = ['INBOX', 'personal', 'announce', 'list']
|
|
|
|
|
2013-04-20 00:28:17 +02:00
|
|
|
def mycmp(x, y):
|
|
|
|
for prefix in prioritized:
|
|
|
|
xsw = x.startswith(prefix)
|
|
|
|
ysw = y.startswith(prefix)
|
|
|
|
if xsw and ysw:
|
|
|
|
return cmp(x, y)
|
|
|
|
elif xsw:
|
|
|
|
return -1
|
|
|
|
elif ysw:
|
|
|
|
return +1
|
2011-01-15 16:48:30 +01:00
|
|
|
return cmp(x, y)
|
2013-04-20 00:28:17 +02:00
|
|
|
|
|
|
|
def test_mycmp():
|
|
|
|
import os, os.path
|
|
|
|
folders=os.listdir(os.path.expanduser('~/data/mail/tv@hq.yok.utu.fi'))
|
|
|
|
folders.sort(mycmp)
|
|
|
|
print folders
|
2011-01-15 16:48:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
This code snippet illustrates how the foldersort option can be customized with a
|
|
|
|
Python function from the pythonfile to always synchronize certain folders first.
|