|
NAME="GENERATOR"
CLASS="REFERENCE"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
>I. OfflineIMAP Manual
offlineimapSynopsisofflineimap [-1] [-P profiledir] [-a accountlist] [-c configfile] [-d debugtype[,...]] [-o] [-u interface] offlineimap -h | --help DescriptionOfflineIMAP 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 support, or does not provide disconnected operation. OfflineIMAP is FAST; it synchronizes my two accounts with over 50 folders in 3 seconds. Other similar tools might take over a minute, and achieve a less-reliable result. Some mail readers can take over 10 minutes to do the same thing, and some don't even support it at all. Unlike other mail tools, OfflineIMAP features a multi-threaded synchronization algorithm that can dramatically speed up performance in many situations by synchronizing several different things simultaneously. OfflineIMAP is FLEXIBLE; you can customize which folders are synced via regular expressions, lists, or Python expressions; a versatile and comprehensive configuration file is used to control behavior; two user interfaces are built-in; fine-tuning of synchronization performance is possible; internal or external automation is supported; SSL and PREAUTH tunnels are both supported; offline (or "unplugged") reading is supported; and esoteric IMAP features are supported to ensure compatibility with the widest variety of IMAP servers. OfflineIMAP is SAFE; it uses an algorithm designed to prevent mail loss at all costs. Because of the design of this algorithm, even programming errors should not result in loss of mail. I am so confident in the algorithm that I use my own personal and work accounts for testing of OfflineIMAP pre-release, development, and beta releases. Of course, legally speaking, OfflineIMAP comes with no warranty, so I am not responsible if this turns out to be wrong. Method of OperationOfflineIMAP operates by maintaining a hierarchy of mail folders in Maildir format locally. Your own mail reader will read mail from this tree, and need never know that the mail comes from IMAP. OfflineIMAP will detect changes to the mail folders on your IMAP server and your own computer and bi-directionally synchronize them, copying, marking, and deleting messages as necessary. Quick StartIf you have already installed OfflineIMAP system-wide, or your system adminstrator has done that for you, your task for setting up OfflineIMAP for the first time is quite simple. You just need to set up your configuration file, make your folder directory, and run it! You can quickly set up your configuration file. The distribution includes a file offlineimap.conf.minimal (Debian users may find this at /usr/share/doc/offlineimap/examples/offlineimap.conf.minimal) that is a basic example of setting of OfflineIMAP. You can simply copy this file into your home directory and name it .offlineimaprc (note the leading period). A command such as cp offlineimap.conf.minimal ~/.offlineimaprc will do it. Or, if you prefer, you can just copy this text to ~/.offlineimaprc: [general] accounts = Test [Test] localfolders = ~/Test remotehost = examplehost remoteuser = jgoerzen 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! To run OfflineIMAP, you just have to say offlineimap -- it will fire up, ask you for a login password if necessary, synchronize your folders, and exit. See? You can just throw away the rest of this finely-crafted, perfectly-honed manual! Of course, if you want to see how you can make OfflineIMAP FIVE TIMES FASTER FOR JUST $19.95 (err, well, $0), you have to read on! InstallationIf you are reading this document via the "man" command, it is likely that you have no installation tasks to perform; your system administrator has already installed it. If you need to install it yourself, you have three options: a system-wide installation with Debian, system-wide installation with other systems, and a single-user installation. You can download the latest version of OfflineIMAP from the OfflineIMAP website. PrerequisitesIn order to use OfflineIMAP, you need to have these conditions satisfied:
System-Wide Installation, DebianIf you are tracking Debian unstable, you may install OfflineIMAP by simply running the following command as root: apt-get install offlineimap If you are not tracking Debian unstable, download the Debian .deb package from the OfflineIMAP website and then run dpkg -i to install the downloaded package. Then, skip to Configruation below. You will type offlineimap to invoke the program. System-Wide Installation, OtherDownload the tar.gz version of the package from the website. Then run these commands, making sure that you are the "root" user first: tar -zxvf offlineimap_x.y.z.tar.gz cd offlineimap-x.y.z python2.2 setup.py install On some systems, you will need to use python instead of python2.2. Next, proceed to Configruation below. You will type offlineimap to invoke the program. Single-Account InstallationDownload the tar.gz version of the package from the website. Then run these commands: tar -zxvf offlineimap_x.y.z.tar.gz cd offlineimap-x.y.z When you want to run OfflineIMAP, you will issue the cd command as above and then type ./offlineimap.py; there is no installation step necessary. ConfigruationOfflineIMAP is regulated by a configuration file that is normally stored in ~/.offlineimaprc. OfflineIMAP ships with a file named offlineimap.conf that you should copy to that location and then edit. This file is vital to proper operation of the system; it sets everything you need to run OfflineIMAP. Full documentation for the configuration file is included within the sample file. OfflineIMAP also ships a file named offlineimap.conf.minimal that you can also try. It's useful if you want to get started with the most basic feature set, and you can read about other features later with offlineimap.conf. OptionsMost configuration is done via the configuration file. Nevertheless, there are a few command-line options that you may set for OfflineIMAP.
User InterfacesOfflineIMAP has a pluggable user interface system that lets you choose how the program communicates information to you. There are two graphical interfaces, two terminal interfaces, and two noninteractive interfaces suitable for scripting or logging purposes. The ui option in the configuration file specifies user interface preferences. The -u command-line option can override the configuration file setting. The available values for the configuration file or command-line are described in this section. Tk.BlinkenlightsTk.Blinkenlights is an interface designed to be sleek, fun to watch, and informative of the overall picture of what OfflineIMAP is doing. I consider it to be the best general-purpose interface in OfflineIMAP. Tk.Blinkenlights contains, by default, a small window with a row of LEDs, a small log, and a row of command buttons. The total size of the window is very small, so it uses little desktop space, yet it is quite functional. The optional, toggleable, log shows more detail about what is happening and is color-coded to match the color of the lights. Tk.Blinkenlights is the only user interface that has configurable parameters; see the example offlineimap.conf for more details. Each light in the Blinkenlights interface represents a thread of execution -- that is, a particular task that OfflineIMAP is performing right now. The colors indicate what task the particular thread is performing, and are as follows:
The name of this interfaces derives from a bit of computer history. Eric Raymond's [Jargon File] defines blinkenlights, in part, as:
Curses.BlinkenlightsCurses.Blinkenlights is an interface very similar to Tk.Blinkenlights, but is designed to be run in a console window (an xterm, Linux virtual terminal, etc.) Since it doesn't have access to graphics, it isn't quite as pretty, but it still gets the job done. Please see the Tk.Blinkenlights section above for more information about the colors used in this interface. Tk.VerboseUITk.VerboseUI (formerly known as Tk.TkUI) is a graphical interface that presents a variable-sized window. In the window, each currently-executing thread has a section where its name and current status are displayed. This interface is best suited to people running on slower connections, as you get a lot of detail, but for fast connections, the detail may go by too quickly to be useful. People with fast connections may wish to use Tk.Blinkenlights instead. TTY.TTYUITTY.TTYUI interface is for people running in basic, non-color terminals. It prints out basic status messages and is generally friendly to use on a console or xterm. Noninteractive.BasicNoninteractive.Basic is designed for situations in which OfflineIMAP will be run non-attended and the status of its execution will be logged. You might use it, for instance, to have the system run automatically and e-mail you the results of the synchronization. This user interface is not capable of reading a password from the keyboard; account passwords must be specified using one of the configuration file options. Noninteractive.QuietNoninteractive.Quiet is designed for non-attended running in situations where normal status messages are not desired. It will output nothing except errors and serious warnings. Like Noninteractive.Basic, this user interface is not capable of reading a password from the keyboard; account passwords must be specified using one of the configuration file options. ExamplesHere are some example configurations for various situations. Please e-mail any other examples you have that may be useful to me. Multiple Accounts with MuttThis 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. Then, in your ~/.offlineimaprc, specify: accounts = Personal, Work Make sure that you have both a [Personal] and a [Work] section, each with different localfolder path names. Also, make sure to enable [mbnames]. In each account section, write something like this: localfolders = ~/Mail/Personal Finally, add these lines to your ~/.muttrc: 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 That's it! UW-IMAPD and ReferencesSome 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 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 folders synced to just three. [Gerf] localfolders = ~/Mail remotehost = gerf.org ssl = yes remoteuser = docwhat reference = Mail # Trims off the preceeding Mail on all the folder names. nametrans = lambda foldername: \ re.sub('^Mail/', '', foldername) # Yeah, you have to mention the Mail dir, even though it # would seem intuitive that reference would trim it. folderfilter = lambda foldername: foldername in [ 'Mail/INBOX', 'Mail/list/zaurus-general', 'Mail/list/zaurus-dev', ] maxconnections = 1 holdconnectionopen = no pythonfile Configuration File OptionYou 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. In ~/.offlineimap.rc, he adds these options: [general] pythonfile=~/.offlineimap.py [foo] foldersort=mycmp Then, the ~/.offlineimap.py file will contain: prioritized = ['INBOX', 'personal', 'announce', 'list'] def mycmp(x, y): for prefix in prioritized: if x.startswith(prefix): return -1 elif y.startswith(prefix): return +1 return cmp(x, y) 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 This code snippet illustrates how the foldersort option can be customized with a Python function from the pythonfile to always synchronize certain folders first. ErrorsIf you get one of some frequently-encountered or confusing errors, please check this section. UID validity problem for folderIMAP servers use a unique ID (UID) to refer to a specific message. This number is guaranteed to be unique to a particular message forever. No other message in the same folder will ever get the same UID. UIDs are an integral part of OfflineIMAP's synchronization scheme; they are used to match up messages on your computer to messages on the server. Sometimes, the UIDs on the server might get reset. Usually this will happen if you delete and then recreate a folder. When you create a folder, the server will often start the UID back from 1. But OfflineIMAP might still have the UIDs from the previous folder by the same name stored. OfflineIMAP will detect this condition and skip the folder. This is GOOD, because it prevents data loss. You can fix it by removing your local folder and cache data. For instance, if your folders are under ~/Folders and the folder with the problem is INBOX, you'd type this: rm -r ~/Folders/INBOX rm -r ~/.offlineimap/AccountName/INBOX (Of course, replace AccountName with the account name as specified in ~/.offlineimaprc). Next time you run OfflineIMAP, it will re-download the folder with the new UIDs. Note that the procedure specified above will lose any local changes made to the folder. Some IMAP servers are broken and do not support UIDs properly. If you continue to get this error for all your folders even after performing the above procedure, it is likely that your IMAP server falls into this category. OfflineIMAP is incompatible with such servers. Using OfflineIMAP with them will not destroy any mail, but at the same time, it will not actually synchronize it either. (OfflineIMAP will detect this condition and abort prior to synchronization.) Other Frequently Asked QuestionsThere are some other FAQs that might not fit into another section of the document, so they are discussed here.
Conforming To
NotesDeleting Local FoldersOfflineIMAP does a two-way synchronization. That is, if you make a change to the mail on the server, it will be propogated to your local copy, and vise-versa. Some people might think that it would be wise to just delete all their local mail folders periodically. If you do this with OfflineIMAP, remember to also remove your local status cache (~/.offlineimap by default). Otherwise, OfflineIMAP will take this as an intentional deletion of many messages and will interpret your action as requesting them to be deleted from the server as well. (If you don't understand this, don't worry; you probably won't encounter this situation) Copying Messages Between FoldersNormally, when you copy a message between folders or add a new message to a folder locally, OfflineIMAP will just do the right thing. However, sometimes this can be tricky -- if your IMAP server does not provide the SEARCH command, or does not return something useful, OfflineIMAP cannot determine the new UID of the message. So, in these rare instances, OfflineIMAP will upload the message to the IMAP server and delete it from your local folder. Then, on your next sync, the message will be re-downloaded with the proper UID. OfflineIMAP makes sure that the message was properly uploaded before deleting it, so there should be no risk of data loss. Use with EvolutionOfflineIMAP can work with Evolution. To do so, first configure your OfflineIMAP account to have sep = / in its configuration. Then, configure Evolution with the "Maildir-format mail directories" server type. For the path, you will need to specify the name of the top-level folder inside your OfflineIMAP storage location. You're now set! Use with KMailAt this time, I believe that OfflineIMAP is not compatible with KMail. KMail cannot work in any mode other than to move all messages out of all folders immediately, which (besides being annoying and fundamentally broken) is incompatible with OfflineIMAP. Mailing ListThere is an OfflineIMAP mailing list available. To subscribe, send the text "Subscribe" in the subject of a mail to offlineimap-request@complete.org. To post, send the message to offlineimap@complete.org. BugsReports of bugs should be sent via e-mail to the OfflineIMAP bug-tracking system (BTS) at offlineimap@bugs.complete.org or submitted online using the web interface. The Web site also lists all current bugs, where you can check their status or contribute to fixing them. CopyrightOfflineIMAP, and this manual, are Copyright © 2002, 2003 John Goerzen. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA imaplib.py comes from the Python dev tree and is licensed under the GPL-compatible PSF license as stated in the file COPYRIGHT in the OfflineIMAP distribution. AuthorOfflineIMAP, its libraries, documentation, and all included files, except where noted, was written by John Goerzen <jgoerzen@complete.org> and copyright is held as stated in the COPYRIGHT section. OfflineIMAP may be downloaded, and information found, from is homepage via either Gopher or HTTP. OfflineIMAP may also be downloaded using Subversion. Additionally, the distributed tar.gz may be updated with a simple "svn update" command; it is ready to go. For information on getting OfflineIMAP with Subversion, please visit the complete.org Subversion page. |