]> code.delx.au - offlineimap/blob - offlineimap.sgml
Step 2 of SVN to arch tree conversion
[offlineimap] / offlineimap.sgml
1 <!DOCTYPE reference PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
2 <!ENTITY OfflineIMAP "<application>OfflineIMAP</application>">
3 ]>
4 <!-- "file:///usr/share/sgml/docbook/dtd/xml/4.2/docbookx.dtd"> -->
5
6 <reference>
7 <title>OfflineIMAP Manual</title>
8
9 <refentry>
10 <refentryinfo>
11 <address><email>jgoerzen@complete.org</email></address>
12 <author><firstname>John</firstname><surname>Goerzen</surname></author>
13 <date> $Date: 2004-07-26 10:37:45 -0500 (Mon, 26 Jul 2004) $ </date>
14 </refentryinfo>
15
16 <refmeta>
17 <refentrytitle>offlineimap</refentrytitle>
18 <manvolnum>1</manvolnum>
19 <refmiscinfo>John Goerzen</refmiscinfo>
20 </refmeta>
21
22 <refnamediv>
23 <refname>OfflineIMAP</refname>
24 <refpurpose>Powerful IMAP/Maildir synchronization
25 and reader support</refpurpose>
26 </refnamediv>
27
28 <refsynopsisdiv>
29 <cmdsynopsis>
30 <command>offlineimap</command>
31 <arg>-1</arg>
32 <arg>-P <replaceable>profiledir</replaceable></arg>
33 <arg>-a <replaceable>accountlist</replaceable></arg>
34 <arg>-c <replaceable>configfile</replaceable></arg>
35 <arg>-d <replaceable>debugtype[,...]</replaceable></arg>
36 <arg>-l <replaceable>filename</replaceable></arg>
37 <arg>-o</arg>
38 <arg>-u <replaceable>interface</replaceable></arg>
39 </cmdsynopsis>
40 <cmdsynopsis>
41 <command>offlineimap</command>
42 <group choice="plain"><arg>-h</arg><arg>--help</arg></group>
43 </cmdsynopsis>
44 </refsynopsisdiv>
45
46 <refsect1>
47 <title>Description</title>
48
49 <para>&OfflineIMAP; is a tool to simplify your e-mail
50 reading. With &OfflineIMAP;, you can read the same mailbox
51 from multiple computers. You get a current copy of your
52 messages on each computer, and changes you make one place will be
53 visible on all other systems. For instance, you can delete a message
54 on your home computer, and it will appear deleted on your work
55 computer as well. &OfflineIMAP; is also useful if you want to
56 use a mail reader that does not have IMAP support, has poor IMAP
57 support, or does not provide disconnected operation.
58 </para>
59
60 <para>&OfflineIMAP; is <emphasis>FAST</emphasis>; it synchronizes
61 my two accounts with over 50 folders in 3 seconds. Other
62 similar tools might take over a minute, and achieve a
63 less-reliable result. Some mail readers can take over 10
64 minutes to do the same thing, and some don't even support it
65 at all. Unlike other mail tools, &OfflineIMAP; features a
66 multi-threaded synchronization algorithm that can dramatically
67 speed up performance in many situations by synchronizing
68 several different things simultaneously.
69 </para>
70
71 <para>&OfflineIMAP; is <emphasis>FLEXIBLE</emphasis>; you can
72 customize which folders are synced via regular expressions,
73 lists, or Python expressions; a versatile and comprehensive
74 configuration file is used to control behavior; two user
75 interfaces are built-in; fine-tuning of synchronization
76 performance is possible; internal or external automation is
77 supported; SSL and PREAUTH tunnels are both supported; offline
78 (or "unplugged") reading is supported; and esoteric IMAP
79 features are supported to ensure compatibility with the widest
80 variety of IMAP servers.
81 </para>
82
83 <para>&OfflineIMAP; is <emphasis>SAFE</emphasis>; it uses an
84 algorithm designed to prevent mail loss at all costs. Because
85 of the design of this algorithm, even programming errors
86 should not result in loss of mail. I am so confident in the
87 algorithm that I use my own personal and work accounts for
88 testing of &OfflineIMAP; pre-release, development, and beta
89 releases. Of course, legally speaking, &OfflineIMAP; comes
90 with no warranty, so I am not responsible if this turns out
91 to be wrong.
92 </para>
93
94 <refsect2>
95 <title>Method of Operation</title>
96
97 <para>&OfflineIMAP; traditionally
98 operates by maintaining a hierarchy of
99 mail folders in Maildir format locally. Your own mail
100 reader will read mail from this tree, and need never know
101 that the mail comes from IMAP. &OfflineIMAP; will detect
102 changes to the mail folders on your IMAP server and your own
103 computer and bi-directionally synchronize them, copying,
104 marking, and deleting messages as necessary.
105 </para>
106 <para>
107 With &OfflineIMAP; 4.0, a powerful new ability has been
108 introduced -- the program can now synchronize two IMAP
109 servers with each other, with no need to have a Maildir
110 layer in-between. Many people use this if they use a mail
111 reader on their local machine that does not support
112 Maildirs. People may install an IMAP server on their local
113 machine, and point both &OfflineIMAP; and their mail reader
114 of choice at it. This is often preferable to the mail
115 reader's own IMAP support since &OfflineIMAP; supports many
116 features (offline reading, for one) that most IMAP-aware
117 readers don't. However, this feature is not as time-tested
118 as traditional syncing, so my advice is to stick with normal
119 methods of operation for the time being.
120 </para>
121 </refsect2>
122 </refsect1>
123
124 <refsect1>
125 <title>Quick Start</title>
126 <para>If you have already installed &OfflineIMAP; system-wide,
127 or your system administrator has done that for you, your task
128 for setting up &OfflineIMAP; for the first time is quite
129 simple. You just need to set up your configuration file, make
130 your folder directory, and run it!
131 </para>
132
133 <para>You can quickly set up your configuration file. The distribution
134 includes a file <filename>offlineimap.conf.minimal</filename>
135 (Debian users
136 may find this at
137 <filename>/usr/share/doc/offlineimap/examples/offlineimap.conf.minimal</filename>) that is a basic example of setting of &OfflineIMAP;. You can
138 simply copy this file into your home directory and name it
139 <filename>.offlineimaprc</filename> (note the leading period). A
140 command such as <command>cp offlineimap.conf.minimal ~/.offlineimaprc</command> will do it. Or, if you prefer, you can just copy this text to
141 <filename>~/.offlineimaprc</filename>:
142 </para>
143
144 <PROGRAMLISTING>[general]
145 accounts = Test
146
147 [Account Test]
148 localrepository = Local
149 remoterepository = Remote
150
151 [Repository Local]
152 type = Maildir
153 localfolders = ~/Test
154
155 [Repository Remote]
156 type = IMAP
157 remotehost = examplehost
158 remoteuser = jgoerzen
159 </PROGRAMLISTING>
160
161 <para>Now, edit the <filename>~/.offlineimaprc</filename> file with
162 your favorite editor. All you have to do is specify a directory
163 for your folders to be in (on the <property>localfolders</property>
164 line), the host name of your IMAP server (on the
165 <property>remotehost</property> line), and your login name on
166 the remote (on the <property>remoteuser</property> line). That's
167 it!</para>
168
169 <para>To run &OfflineIMAP;, you just have to say
170 <command>offlineimap</command> -- it will fire up, ask you for
171 a login password if necessary, synchronize your folders, and exit.
172 See? You can just throw away the rest of this finely-crafted,
173 perfectly-honed manual! Of course, if you want to see how you can
174 make &OfflineIMAP; FIVE TIMES FASTER FOR JUST $19.95 (err, well,
175 $0), you have to read on!
176 </para>
177
178 </refsect1>
179
180 <refsect1>
181 <title>Installation</title>
182
183 <para>If you are reading this document via the "man" command, it is
184 likely
185 that you have no installation tasks to perform; your system
186 administrator has already installed it. If you need to install it
187 yourself, you have three options: a system-wide installation with
188 Debian, system-wide installation with other systems, and a single-user
189 installation. You can download the latest version of &OfflineIMAP; from
190 <ulink url="http://quux.org/devel/offlineimap/">the &OfflineIMAP;
191 website</ulink>.
192 </para>
193
194 <refsect2>
195 <title>Prerequisites</title>
196
197 <para>In order to use &OfflineIMAP;, you need to have these conditions
198 satisfied:
199 </para>
200
201 <itemizedlist>
202 <listitem>
203 <para>Your mail server must support IMAP. Most Internet Service
204 Providers
205 and corporate networks do, and most operating systems
206 have an IMAP
207 implementation readily available.
208 </para>
209 </listitem>
210 <listitem>
211 <para>
212 You must have Python version 2.2.1 or above installed.
213 If you are
214 running on Debian GNU/Linux, this requirement will automatically be
215 taken care of for you. If you do not have Python already, check with
216 your system administrator or operating system vendor; or, download it from
217 <ulink url="http://www.python.org/">the Python website</ulink>.
218 If you intend to use the Tk interface, you must have Tkinter
219 (python-tk) installed. If you intend to use the SSL interface, your
220 Python must have been built with SSL support.
221 </para>
222 </listitem>
223 <listitem>
224 <para>
225 Have a mail reader that supports the Maildir mailbox
226 format. Most modern mail readers have this support
227 built-in, so you can choose from a wide variety of mail
228 servers. This format is also known as the "qmail"
229 format, so any mail reader compatible with it will work
230 with &OfflineIMAP;. If you do not have a mail reader
231 that supports Maildir, you can often install a local
232 IMAP server and point both &OfflineIMAP; and your mail
233 reader at it.
234 </para>
235 </itemizedlist>
236 </refsect2>
237
238 <refsect2>
239 <title>System-Wide Installation, Debian</title>
240 <para>
241 If you are tracking Debian unstable, you may install
242 &OfflineIMAP; by simply running the following command as root:
243 </para>
244 <para>
245 <command>apt-get install offlineimap</command>
246 </para>
247 <para>
248 If you are not tracking Debian unstable, download the Debian .deb
249 package from the <ulink url="http://quux.org/devel/offlineimap/">&OfflineIMAP; website</ulink>
250 and then run <command>dpkg -i</command> to install the downloaded
251 package. Then, skip to <xref linkend="configuration" endterm="configuration-title"> below. You will type <command>offlineimap</command> to
252 invoke the program.
253 </para>
254 </refsect2>
255
256 <refsect2>
257 <title>System-Wide Installation, Other</title>
258 <para>
259 Download the tar.gz version of the package from the
260 <ulink url="http://quux.org/devel/offlineimap/">website</ulink>.
261 Then run
262 these commands, making sure that you are the "root" user first:
263 </para>
264
265 <ProgramListing>tar -zxvf offlineimap_x.y.z.tar.gz
266 cd offlineimap-x.y.z
267 python2.2 setup.py install</ProgramListing>
268 <para>On some systems, you will need to use
269 <command>python</command> instead of <command>python2.2</command>.
270 Next, proceed to <xref linkend="configuration" endterm="configuration-title"> below. You will type <command>offlineimap</command> to
271 invoke the program.
272 </para>
273 </refsect2>
274
275 <refsect2>
276 <title>Single-Account Installation</title>
277 <para>
278 Download the tar.gz version of the package from the
279 <ulink url="http://quux.org/devel/offlineimap/">website</ulink>.
280 Then run these commands:
281 </para>
282
283 <ProgramListing>tar -zxvf offlineimap_x.y.z.tar.gz
284 cd offlineimap-x.y.z</ProgramListing>
285
286 <para>When you want to run &OfflineIMAP;, you will issue the
287 <command>cd</command> command as above and then type
288 <command>./offlineimap.py</command>; there is no installation
289 step necessary.
290 </para>
291 </refsect2>
292 </refsect1>
293
294 <refsect1 id="configuration">
295 <title id="configuration-title">Configuration</title>
296 <para>
297 &OfflineIMAP; is regulated by a configuration file that is normally
298 stored in <filename>~/.offlineimaprc</filename>. &OfflineIMAP;
299 ships with a file named <filename>offlineimap.conf</filename>
300 that you should copy to that location and then edit. This file is
301 vital to proper operation of the system; it sets everything you need
302 to run &OfflineIMAP;. Full documentation for the configuration file
303 is included within the sample file.
304 </para>
305 <para>
306 &OfflineIMAP; also ships a file named
307 <filename>offlineimap.conf.minimal</filename> that you can also try.
308 It's useful if you want to get started with
309 the most basic feature set, and you can read about other features
310 later with <filename>offlineimap.conf</filename>.
311 </para>
312 </refsect1>
313
314 <refsect1>
315 <title>Options</title>
316 <para>
317 Most configuration is done via the configuration file. Nevertheless,
318 there are a few command-line options that you may set for
319 &OfflineIMAP;.
320 </para>
321
322 <variablelist>
323 <varlistentry><term>-1</term>
324 <listitem><para>Disable most multithreading operations and use
325 solely a single-connection
326 sync. This effectively sets the
327 <property>maxsyncaccounts</property>
328 and all <property>maxconnections</property> configuration file
329 variables to 1.
330 </para></listitem>
331 </varlistentry>
332 <varlistentry><term>-P <replaceable>profiledir</replaceable></term>
333 <listitem><para>Sets &OfflineIMAP; into profile mode. The program
334 will create <replaceable>profiledir</replaceable>
335 (it must not already exist). As it runs, Python profiling
336 information
337 about each thread is logged into profiledir. Please note: This option
338 is present for debugging and optimization only, and should NOT be used
339 unless you have a specific reason to do so. It will significantly
340 slow program performance, may reduce reliability, and can generate
341 huge amounts of data. You must use the <option>-1</option> option when
342 you use <option>-P</option>.
343 </para></listitem>
344 </varlistentry>
345 <varlistentry><term>-a <replaceable>accountlist</replaceable></term>
346 <listitem><para>Overrides the <property>accounts</property> option
347 in the <property>general</property> section of the configuration
348 file. You might use this to exclude certain accounts, or to sync
349 some accounts that you normally prefer not to. Separate the
350 accounts by commas, and use no embedded spaces.
351 </para></listitem>
352 </varlistentry>
353 <varlistentry><term>-c <replaceable>configfile</replaceable></term>
354 <listitem><para>Specifies a configuration file to use in lieu of
355 the default, <filename>~/.offlineimaprc</filename>.
356 </para></listitem>
357 </varlistentry>
358 <varlistentry><term>-d <replaceable>debugtype[,...]</replaceable></term>
359 <listitem><para>Enables debugging for OfflineIMAP. This is useful if
360 you are trying to track down a malfunction or figure out what is going
361 on under the hood. I suggest that you use this with
362 <option>-1</option> to make the results more sensible.</para>
363
364 <para><option>-d</option> requires one or more debugtypes,
365 separated by commas. These define what exactly will be
366 debugged, and include three options: <property>imap</property>,
367 <property>maildir</property>, and <property>thread</property>.
368 The <property>imap</property>
369 option will enable IMAP protocol stream and parsing debugging. Note
370 that the output may contain passwords, so take care to remove that
371 from the debugging output before sending it to anyone else. The
372 <property>maildir</property> option will enable debugging for
373 certain Maildir operations. And <property>thread</property>
374 will debug the threading model.
375 </para></listitem>
376 </varlistentry>
377 <varlistentry><term>-l
378 <replaceable>filename</replaceable></term>
379 <listitem><para>
380 Enables logging to filename. This will log everything
381 that goes to the screen to the specified file.
382 Additionally, if any debugging is specified with -d,
383 then debug messages will not go to the screen, but
384 instead to the logfile only.</para>
385 </listitem>
386 </varlistentry>
387 <varlistentry><term>-o</term>
388 <listitem><para>Run only once, ignoring all
389 <property>autorefresh</property> settings in the configuration
390 file.</para>
391 </listitem>
392 </varlistentry>
393 <varlistentry><term>-h</term> <term>--help</term>
394 <listitem><para>Show summary of options.</para></listitem>
395 </varlistentry>
396 <varlistentry><term>-u <replaceable>interface</replaceable></term>
397 <listitem><para>Specifies an alternative user interface module
398 to use. This overrides the default specified in the
399 configuration file. The pre-defined options are listed in
400 the User Interfaces section.</para>
401 </listitem>
402 </varlistentry>
403 </variablelist>
404 </refsect1>
405 <refsect1>
406 <title>User Interfaces</title>
407 <para>&OfflineIMAP; has a pluggable user interface system that lets you choose how the
408 program communicates information to you. There are two graphical
409 interfaces, two terminal interfaces, and two noninteractive interfaces
410 suitable for scripting or logging purposes. The
411 <property>ui</property> option in the configuration file specifies
412 user interface preferences. The <option>-u</option> command-line
413 option can override the configuration file setting. The available
414 values for the configuration file or command-line are described
415 in this section.</para>
416 <refsect2>
417 <title>Tk.Blinkenlights</title>
418 <para>Tk.Blinkenlights is an interface designed to be sleek, fun to watch, and
419 informative of the overall picture of what &OfflineIMAP;
420 is doing. I consider it to be the best general-purpose interface in
421 &OfflineIMAP;.
422 </para>
423 <para>
424 Tk.Blinkenlights contains, by default, a small window with a row of
425 LEDs, a small log, and a row of command buttons.
426 The total size of the window is
427 very small, so it uses little desktop space, yet it is quite
428 functional. The optional, toggleable, log shows more
429 detail about what is happening and is color-coded to match the color
430 of the lights.
431 </para>
432 <para>
433 Tk.Blinkenlights is the only user interface that has configurable
434 parameters; see the example <filename>offlineimap.conf</filename>
435 for more details.
436 </para>
437 <para>
438 Each light in the Blinkenlights interface represents a thread
439 of execution -- that is, a particular task that &OfflineIMAP;
440 is performing right now. The colors indicate what task
441 the particular thread is performing, and are as follows:
442 </para>
443 <variablelist>
444 <varlistentry>
445 <term>Black</term>
446 <listitem><para>indicates that this light's thread has terminated; it will light up
447 again later when new threads start up. So, black indicates no
448 activity.
449 </para></listitem>
450 </varlistentry>
451 <varlistentry>
452 <term>Red (Meaning 1)</term>
453 <listitem><para>is the color of the main program's thread, which basically does
454 nothing but monitor the others. It might remind you of HAL 9000 in
455 <citation>2001</citation>.
456 </para></listitem>
457 </varlistentry>
458 <varlistentry>
459 <term>Gray</term>
460 <listitem><para>indicates that the thread is establishing a new connection to the IMAP
461 server.
462 </para></listitem>
463 </varlistentry>
464 <varlistentry>
465 <term>Purple</term>
466 <listitem><para>is the color of an account synchronization thread that is monitoring
467 the progress of the folders in that account (not generating any I/O).
468 </para></listitem>
469 </varlistentry>
470 <varlistentry>
471 <term>Cyan</term>
472 <listitem><para>indicates that the thread is syncing a folder.
473 </para></listitem>
474 </varlistentry>
475 <varlistentry>
476 <term>Green</term>
477 <listitem><para>means that a folder's message list is being loaded.
478 </para></listitem>
479 </varlistentry>
480 <varlistentry>
481 <term>Blue</term>
482 <listitem><para>is the color of a message synchronization controller thread.
483 </para></listitem>
484 </varlistentry>
485 <varlistentry>
486 <term>Orange</term>
487 <listitem><para>indicates that an actual message is being copied.
488 (We use fuchsia for fake messages.)
489 </para></listitem>
490 </varlistentry>
491 <varlistentry>
492 <term>Red (meaning 2)</term>
493 <listitem><para>indicates that a message is being deleted.
494 </para></listitem>
495 </varlistentry>
496 <varlistentry>
497 <term>Yellow / bright orange</term>
498 <listitem><para>indicates that message flags are being added.
499 </para></listitem>
500 </varlistentry>
501 <varlistentry>
502 <term>Pink / bright red</term>
503 <listitem><para>indicates that message flags are being removed.
504 </para></listitem>
505 </varlistentry>
506 <varlistentry>
507 <term>Red / Black Flashing</term>
508 <listitem><para>corresponds to the countdown timer that runs between
509 synchronizations.
510 </para></listitem>
511 </varlistentry>
512 </variablelist>
513 <para>The name of this interfaces derives from a bit of computer
514 history. Eric Raymond's <citation>Jargon File</citation> defines
515 <firstterm>blinkenlights</firstterm>, in part, as:
516 </para>
517 <blockquote>
518 <para>Front-panel diagnostic
519 lights on a computer, esp. a dinosaur. Now that dinosaurs are rare,
520 this term usually refers to status lights on a modem, network hub, or
521 the like.
522 </para>
523 <para>
524 This term derives from the last word of the famous blackletter-Gothic
525 sign in mangled pseudo-German that once graced about half the computer
526 rooms in the English-speaking world. One version ran in its entirety as
527 follows:
528 </para>
529 <para>
530 <emphasis>ACHTUNG! ALLES LOOKENSPEEPERS!</emphasis>
531 </para>
532 <para>
533 Das computermachine ist nicht fuer gefingerpoken und mittengrabben.
534 Ist easy schnappen der springenwerk, blowenfusen und poppencorken
535 mit spitzensparken. Ist nicht fuer gewerken bei das dumpkopfen.
536 Das rubbernecken sichtseeren keepen das cotten-pickenen hans in das
537 pockets muss; relaxen und watchen das blinkenlichten.
538 </para>
539 </blockquote>
540 </refsect2>
541
542 <refsect2>
543 <title>Curses.Blinkenlights</title>
544 <para>
545 Curses.Blinkenlights is an interface very similar to Tk.Blinkenlights,
546 but is designed to be run in a console window (an xterm, Linux virtual
547 terminal, etc.) Since it doesn't have access to graphics, it isn't
548 quite as pretty, but it still gets the job done.
549 </para>
550 <para>Please see the Tk.Blinkenlights section above for more
551 information about the colors used in this interface.
552 </para>
553 </refsect2>
554
555 <refsect2>
556 <title>Tk.VerboseUI</title>
557 <para>
558 Tk.VerboseUI (formerly known as Tk.TkUI) is a graphical interface
559 that presents a variable-sized window. In the window, each
560 currently-executing thread has a section where its name and current
561 status are displayed. This interface is best suited to people running
562 on slower connections, as you get a lot of detail, but for fast
563 connections, the detail may go by too quickly to be useful. People
564 with fast connections may wish to use Tk.Blinkenlights instead.
565 </para>
566 </refsect2>
567
568 <refsect2>
569 <title>TTY.TTYUI</title>
570 <para>
571 TTY.TTYUI interface is for people running in basic, non-color terminals. It
572 prints out basic status messages and is generally friendly to use on a console
573 or xterm.
574 </para>
575 </refsect2>
576
577 <refsect2>
578 <title>Noninteractive.Basic</title>
579 <para>
580 Noninteractive.Basic is designed for situations in which &OfflineIMAP;
581 will be run non-attended and the status of its execution will be
582 logged. You might use it, for instance, to have the system run
583 automatically and
584 e-mail you the results of the synchronization. This user interface
585 is not capable of reading a password from the keyboard; account
586 passwords must be specified using one of the configuration file options.
587 </para>
588 </refsect2>
589
590 <refsect2>
591 <title>Noninteractive.Quiet</title>
592 <para>
593 Noninteractive.Quiet is designed for non-attended running in situations
594 where normal status messages are not desired. It will output nothing
595 except errors and serious warnings. Like Noninteractive.Basic,
596 this user interface
597 is not capable of reading a password from the keyboard; account
598 passwords must be specified using one of the configuration file options.
599 </para>
600 </refsect2>
601
602 </refsect1>
603
604 <refsect1>
605 <title>Examples</title>
606 <para>Here are some example configurations for various situations.
607 Please e-mail any other examples you have that may be useful to
608 me.
609 </para>
610
611 <refsect2>
612 <title>Multiple Accounts with Mutt</title>
613 <para>
614 This example shows you how to set up &OfflineIMAP; to
615 synchronize multiple accounts with the mutt mail reader.
616 </para>
617 <para>
618 Start by creating a directory to hold your folders by running
619 <command>mkdir ~/Mail</command>. Then, in your
620 <filename>~/.offlineimaprc</filename>, specify:
621 </para>
622 <programlisting>accounts = Personal, Work</programlisting>
623 <para>
624 Make sure that you have both an
625 <property>[Account Personal]</property>
626 and an <property>[Account Work]</property> section. The
627 local repository for each account must have different
628 <property>localfolder</> path names.
629 Also, make sure
630 to enable <property>[mbnames]</property>.
631 </para>
632 <para>
633 In each local repository section, write something like this:
634 </para>
635 <programlisting>localfolders = ~/Mail/Personal</programlisting>
636 <para>
637 Finally, add these lines to your <filename>~/.muttrc</filename>:
638 </para>
639 <programlisting>source ~/path-to-mbnames-muttrc-mailboxes
640 folder-hook Personal set from="youremail@personal.com"
641 folder-hook Work set from="youremail@work.com"
642 set mbox_type=Maildir
643 set folder=$HOME/Mail
644 spoolfile=+Personal/INBOX</programlisting>
645 <para>
646 That's it!
647 </para>
648 </refsect2>
649
650 <refsect2>
651 <title>UW-IMAPD and References</title>
652 <para>Some users with a UW-IMAPD server need to use &OfflineIMAP;'s
653 "reference" feature to get at their mailboxes, specifying a reference
654 of "~/Mail" or "#mh/" depending on the configuration. The below
655 configuration from (originally from docwhat@gerf.org)
656 shows using a <property>reference</property> of Mail, a <property>nametrans</property>
657 that strips
658 the leading Mail/ off incoming folder names, and a
659 <property>folderfilter</property> that
660 limits the folders synced to just three.
661 </para>
662 <programlisting>[Account Gerf]
663 localrepository = GerfLocal
664 remoterepository = GerfRemote
665
666 [Repository GerfLocal]
667 type = Maildir
668 localfolders = ~/Mail
669
670 [Repository GerfRemote]
671 type = IMAP
672 remotehost = gerf.org
673 ssl = yes
674 remoteuser = docwhat
675 reference = Mail
676 # Trims off the preceeding Mail on all the folder names.
677 nametrans = lambda foldername: \
678 re.sub('^Mail/', '', foldername)
679 # Yeah, you have to mention the Mail dir, even though it
680 # would seem intuitive that reference would trim it.
681 folderfilter = lambda foldername: foldername in [
682 'Mail/INBOX',
683 'Mail/list/zaurus-general',
684 'Mail/list/zaurus-dev',
685 ]
686 maxconnections = 1
687 holdconnectionopen = no</programlisting>
688 </refsect2>
689
690 <refsect2>
691 <title>pythonfile Configuration File Option</title>
692 <para>You can have &OfflineIMAP;
693 load up a Python file before evaluating the
694 configuration file options that are Python expressions. This example
695 is based on one supplied by Tommi Virtanen for this feature.
696 </para>
697 <para>
698 In <filename>~/.offlineimap.rc</filename>, he adds these options:
699 </para>
700 <programlisting>[general]
701 pythonfile=~/.offlineimap.py
702 [Repository foo]
703 foldersort=mycmp</programlisting>
704 <para>
705 Then, the <filename>~/.offlineimap.py</filename> file will
706 contain:
707 </para>
708 <programlisting>prioritized = ['INBOX', 'personal', 'announce', 'list']
709
710 def mycmp(x, y):
711 for prefix in prioritized:
712 xsw = x.startswith(prefix)
713 ysw = y.startswith(prefix)
714 if xsw and ysw:
715 return cmp(x, y)
716 elif xsw:
717 return -1
718 elif ysw:
719 return +1
720 return cmp(x, y)
721
722 def test_mycmp():
723 import os, os.path
724 folders=os.listdir(os.path.expanduser('~/data/mail/tv@hq.yok.utu.fi'))
725 folders.sort(mycmp)
726 print folders</programlisting>
727 <para>
728 This code snippet illustrates how the <property>foldersort</property>
729 option can be customized with a Python function from the
730 <property>pythonfile</property> to always synchronize certain
731 folders first.
732 </para>
733 </refsect2>
734 </refsect1>
735
736 <refsect1>
737 <title>Errors</title>
738 <para>
739 If you get one of some frequently-encountered or confusing errors,
740 please check this section.
741 </para>
742
743 <refsect2>
744 <title>UID validity problem for folder</title>
745 <para>IMAP servers use a unique ID (UID) to refer to a specific message.
746 This number is guaranteed to be unique to a particular message
747 <emphasis>forever</emphasis>.
748 No other message in the same folder will ever get the same
749 UID. UIDs are an integral part of &OfflineIMAP;'s synchronization
750 scheme; they are used to match up messages on your computer to
751 messages on the server.
752 </para>
753
754 <para>
755 Sometimes, the UIDs on the server might get reset. Usually this will
756 happen if you delete and then recreate a folder. When you create a
757 folder, the server will often start the UID back from 1. But
758 &OfflineIMAP; might still have the UIDs from the previous folder by the
759 same name stored. &OfflineIMAP; will detect this condition and skip the
760 folder. This is GOOD, because it prevents data loss.
761 </para>
762
763 <para>
764 You can fix it by removing your local folder and cache data. For
765 instance, if your folders are under <filename>~/Folders</filename>
766 and the folder with the problem is INBOX, you'd type this:
767 </para>
768
769 <programlisting>rm -r ~/Folders/INBOX
770 rm -r ~/.offlineimap/Account-<replaceable>AccountName</>
771 rm -r ~/.offlineimap/Repository-<replaceable>RepositoryName</></programlisting>
772
773 <para>
774 (Of course, replace AccountName and RepositoryName
775 with the names as specified
776 in <filename>~/.offlineimaprc</filename>).
777 </para>
778
779 <para>Next time you run &OfflineIMAP;, it will re-download
780 the folder with the
781 new UIDs. Note that the procedure specified above will lose any local
782 changes made to the folder.
783 </para>
784
785 <para>
786 Some IMAP servers are broken and do not support UIDs properly. If you
787 continue to get this error for all your folders even after performing
788 the above procedure, it is likely that your IMAP server falls into
789 this category. &OfflineIMAP; is incompatible with such servers.
790 Using &OfflineIMAP; with them will not destroy any mail, but at the same time,
791 it will not actually synchronize it either. (&OfflineIMAP; will detect
792 this condition and abort prior to synchronization.)
793 </para>
794 <para>
795 This question comes up frequently on the
796 <ulink
797 url="http://lists.complete.org/offlineimap@complete.org/">&OfflineIMAP;
798 mailing list</ulink>. You can find a
799 <ulink
800 url="http://lists.complete.org/offlineimap@complete.org/2003/04/msg00012.html.gz">detailed
801 discussion</ulink> of the problem there.
802 </para>
803 </refsect2>
804 </refsect1>
805 <refsect1>
806 <title>Other Frequently Asked Questions</title>
807 <para>There are some other FAQs that might not fit into another section
808 of the document, so they are discussed here.
809 </para>
810
811 <variablelist>
812 <varlistentry><term>What platforms does &OfflineIMAP; run on?</term>
813 <listitem><para>
814 It should run on most platforms supported by Python, which are quite a
815 few. I do not support Windows myself, but some have made
816 it work there; see the FAQ entry for that platform.
817 </para></listitem>
818 </varlistentry>
819
820 <varlistentry><term>I'm using Mutt. Other IMAP sync programs require me to use "set maildir_trash=yes". Do I need to do that with &OfflineIMAP;?</term>
821 <listitem><para>
822 No. &OfflineIMAP; is smart enough to figure out message deletion without this extra
823 crutch. You'll get the best results if you don't use this setting, in
824 fact.
825 </para></listitem>
826 </varlistentry>
827
828 <varlistentry><term>I've upgraded and now &OfflineIMAP;
829 crashes when I start it up! Why?</term>
830 <listitem><para>You need to upgrade your configuration
831 file. See <xref linkend="upgrading.4.0"> at the end of this
832 manual.
833 </para>
834 </listitem>
835 </varlistentry>
836
837 <varlistentry><term>How do I specify the names of my folders?</term>
838 <listitem><para>
839 You do not need to. &OfflineIMAP; is smart
840 enough to automatically figure out what folders are present
841 on the IMAP server and synchronize them. You can use the
842 <property>folderfilter</property> and <property>foldertrans</property>
843 configuration file options to request certain folders and rename them
844 as they come in if you like.
845 </para></listitem>
846 </varlistentry>
847
848 <varlistentry><term>How can I prevent certain folders from being synced?</term>
849 <listitem><para>
850 Use the <property>folderfilter</property> option in the configuration file.
851 </para></listitem>
852 </varlistentry>
853
854 <varlistentry><term>How can I add or delete a folder?</term>
855 <listitem><para>
856 &OfflineIMAP; does not currently provide this feature, but if you create a new
857 folder on the IMAP server, it will be created locally automatically.
858 </para></listitem>
859 </varlistentry>
860
861 <varlistentry><term>Are there any other warnings that I should be aware of?</term>
862 <listitem><para>
863 Yes; see the Notes section below.
864 </para></listitem>
865 </varlistentry>
866
867 <varlistentry><term>What is the mailbox name recorder (mbnames) for?</term>
868 <listitem><para>Some mail readers, such as Mutt, are not capable
869 of automatically determining the names of your mailboxes.
870 &OfflineIMAP; can help these programs by writing the names
871 of the folders in a format you specify. See the example
872 <filename>offlineimap.conf</filename> for details.
873 </para></listitem>
874 </varlistentry>
875
876 <varlistentry><term>Can I synchronize multiple accounts with &OfflineIMAP?</term>
877 <listitem><para>Sure. Just name them all in the
878 <property>accounts</property> line in the <property>general</property>
879 section of the configuration file, and add a per-account section
880 for each one.
881 </para></listitem>
882 </varlistentry>
883
884 <varlistentry><term>Does &OfflineIMAP; support POP?</term>
885 <listitem><para>No. POP is not robust enough to do a completely reliable
886 multi-machine synchronization like &OfflineIMAP; can do. &OfflineIMAP;
887 will not support it.
888 </para></listitem>
889 </varlistentry>
890
891 <varlistentry><term>Does &OfflineIMAP; support mailbox formats other than Maildir?</term>
892 <listitem><para>Not at present. There is no technical reason not to; just no
893 demand yet. Maildir is a superior format anyway.
894 However, &OfflineIMAP; can sync between two IMAP
895 servers, and some IMAP servers support other formats. You
896 could install an IMAP server on your local machine and have
897 &OfflineIMAP sync to that.
898 </para></listitem>
899 </varlistentry>
900
901 <varlistentry><term>[technical] Why are your Maildir message filenames so huge?</term>
902 <listitem><para>&OfflineIMAP; has two relevant principles: 1) never modifying your
903 messages in any way and 2) ensuring 100% reliable synchronizations.
904 In order to do a reliable sync, &OfflineIMAP;
905 must have a way to
906 uniquely identify each e-mail. Three pieces of information are
907 required to do this: your account name, the folder name, and the
908 message UID. The account name can be calculated from the path in
909 which your messages are. The folder name can usually be as well, BUT
910 some mail clients move messages between folders by simply moving the
911 file, leaving the name intact.
912 </para>
913 <para>
914 So, &OfflineIMAP; must store both a UID folder ID. The folder ID is
915 necessary so &OfflineIMAP; can detect a message moved to a different
916 folder. &OfflineIMAP; stores the UID (U= number) and an md5sum of the
917 foldername (FMD5= number) to facilitate this.
918 </para></listitem>
919 </varlistentry>
920
921 <varlistentry><term>What is the speed of &OfflineIMAP;'s sync?</term>
922 <listitem><para>OfflineIMAP
923 versions 2.0 and above contain a multithreaded system. A good way to
924 experiment is by setting <property>maxsyncaccounts</property> to 3 and <property>maxconnections</property> to 3
925 in each account clause.
926 </para>
927 <para>This lets OfflineIMAP open up multiple connections simultaneously.
928 That will let it process multiple folders and messages at once. In
929 most cases, this will increase performance of the sync.
930 </para>
931 <para>Don't set the number too high. If you do that, things might actually
932 slow down as your link gets saturated. Also, too many connections can
933 cause mail servers to have excessive load. Administrators might take
934 unkindly to this, and the server might bog down. There are many
935 variables in the optimal setting; experimentation may help.
936 </para>
937 <para>An informal benchmark yields these results for my setup:
938 </para>
939 <itemizedlist>
940 <listitem><para>10 minutes with MacOS X Mail.app "manual cache"
941 </para></listitem>
942 <listitem><para>5 minutes with GNUS agent sync</para></listitem>
943 <listitem><para>20 seconds with OfflineIMAP 1.x</para></listitem>
944 <listitem><para>9 seconds with OfflineIMAP 2.x</para></listitem>
945 <listitem><para>3 seconds with OfflineIMAP 3.x "cold start"</para></listitem>
946 <listitem><para>2 seconds with OfflineIMAP 3.x "held connection"</para></listitem>
947 </itemizedlist>
948 </listitem></varlistentry>
949 <varlistentry><term>Can I use &OfflineIMAP; on Windows?</term>
950 <listitem><para>
951 These answers have been reported by &OfflineIMAP;
952 users. I do not run &OfflineIMAP; on Windows myself, so
953 I can't directly address their accuracy.
954 </para>
955 <para>
956 The basic answer is that it's possible and doesn't
957 require hacking &OfflineIMAP; source code. However,
958 it's not necessarily trivial. The information below is
959 based in instructions submitted by Chris Walker.
960 </para>
961 <para>
962 First, you must run &OfflineIMAP; in the <ulink
963 url="http://www.cygwin.com/">Cygwin</ulink>
964 environment.
965 </para>
966 <para>
967 Next, you'll need to mount your Maildir directory in a
968 special way. There is information for doing that at
969 <ulink url="http://barnson.org/node/view/295"></ulink>.
970 That site gives this example:
971 </para>
972 <programlisting>
973 mount -f -s -b -o managed "d:/tmp/mail" "/home/of/mail"
974 </programlisting>
975 <para>
976 That URL also has more details on making OfflineIMAP
977 work with Windows.
978 </para>
979 </listitem>
980 </varlistentry>
981 </variablelist>
982 </refsect1>
983
984 <refsect1>
985 <title>Conforming To</title>
986 <itemizedlist>
987 <listitem><para>Internet Message Access Protocol version 4rev1 (IMAP 4rev1) as
988 specified in RFC2060 and RFC3501</para></listitem>
989 <listitem><para>CRAM-MD5 as specified in RFC2195</para></listitem>
990 <listitem><para>Maildir as specified in
991 <ulink url="http://www.qmail.org/qmail-manual-html/man5/maildir.html">the Maildir manpage</ulink> and
992 <ulink url="http://cr.yp.to/proto/maildir.html">the qmail website</ulink>.</para></listitem>
993 <listitem><para>Standard Python 2.2.1 as implemented on POSIX-compliant systems.</para></listitem>
994 </itemizedlist>
995 </refsect1>
996
997 <refsect1>
998 <title>Notes</title>
999 <refsect2>
1000 <title>Deleting Local Folders</title>
1001 <para>&OfflineIMAP; does a two-way synchronization. That is, if you
1002 make a change to the mail on the server, it will be propagated to your
1003 local copy, and vise-versa. Some people might think that it would be
1004 wise to just delete all their local mail folders periodically. If you
1005 do this with &OfflineIMAP;, remember to also remove your local status
1006 cache (<filename>~/.offlineimap</filename> by default). Otherwise, &OfflineIMAP; will take
1007 this as an intentional deletion of many messages and will interpret
1008 your action as requesting them to be deleted from the server as well.
1009 (If you don't understand this, don't worry; you probably won't
1010 encounter this situation)
1011 </para>
1012 </refsect2>
1013
1014 <refsect2>
1015 <title>Multiple Instances</title>
1016 <para>&OfflineIMAP; is not designed to have several instances (for instance, a cron job and an interactive invocation) run over the same
1017 mailbox simultaneously. It will perform a check on startup and
1018 abort if another &OfflineIMAP; is already running. If you need
1019 to schedule synchronizations, please use the
1020 <property>autorefresh</property> settings rather than cron.
1021 Alternatively, you can set a separate <property>metadata</property>
1022 directory for each instance.
1023 </para>
1024 </refsect2>
1025
1026 <refsect2>
1027 <title>Copying Messages Between Folders</title>
1028 <para>
1029 Normally, when you copy a message between folders or add a new message
1030 to a folder locally, &OfflineIMAP;
1031 will just do the right thing. However, sometimes this can be tricky
1032 -- if your IMAP server does not provide the SEARCH command, or does
1033 not return something useful, &OfflineIMAP;
1034 cannot determine the new UID of the message. So, in these rare
1035 instances, OfflineIMAP will upload the message to the IMAP server and
1036 delete it from your local folder. Then, on your next sync, the
1037 message will be re-downloaded with the proper UID.
1038 &OfflineIMAP; makes sure that the message was properly uploaded before deleting it,
1039 so there should be no risk of data loss.
1040 </para>
1041 </refsect2>
1042
1043 <refsect2>
1044 <title>Use with Evolution</title>
1045 <para>&OfflineIMAP; can work with Evolution. To do so, first configure
1046 your &OfflineIMAP; account to have
1047 <option>sep = /</option> in its configuration. Then, configure
1048 Evolution with the
1049 "Maildir-format mail directories" server type. For the path, you will need to
1050 specify the name of the top-level folder
1051 <emphasis>inside</emphasis> your &OfflineIMAP; storage location.
1052 You're now set!
1053 </para>
1054 </refsect2>
1055
1056 <refsect2>
1057 <title>Use with KMail</title>
1058 <para>At this time, I believe that &OfflineIMAP; with Maildirs
1059 is not compatible
1060 with KMail. KMail cannot work in any mode other than to move
1061 all messages out of all folders immediately, which (besides being annoying
1062 and fundamentally broken) is incompatible with
1063 &OfflineIMAP;.
1064 </para>
1065 <para>
1066 However, I have made KMail version 3 work well with
1067 &OfflineIMAP; by installing an IMAP server on my local
1068 machine, having &OfflineIMAP; sync to that, and pointing
1069 KMail at the same server.
1070 </para>
1071 </refsect2>
1072
1073 <refsect2>
1074 <title>Mailing List</title>
1075 <para>There is an OfflineIMAP mailing list available.
1076 To subscribe, send the text "Subscribe" in the subject of a mail to
1077 offlineimap-request@complete.org. To post, send the message to
1078 offlineimap@complete.org. Archives are available at
1079 <ulink url="http://lists.complete.org/offlineimap@complete.org/"></>.
1080 </para>
1081 </refsect2>
1082
1083 <refsect2>
1084 <title>Bugs</title>
1085 <para>Reports of bugs should be sent via e-mail to the
1086 &OfflineIMAP; bug-tracking system (BTS) at
1087 offlineimap@bugs.complete.org or submitted online using
1088 the <ulink url="http://bugs.complete.org/">web interface</ulink>.
1089 </para>
1090 <para>
1091 The Web site also lists all current bugs, where you can check their
1092 status or contribute to fixing them.
1093 </para>
1094 </refsect2>
1095 </refsect1>
1096
1097 <refsect1 id="upgrading.4.0">
1098 <title>Upgrading to 4.0</title>
1099 <para>
1100 If you are upgrading from a version of &OfflineIMAP; prior to
1101 3.99.12, you will find that you will get errors when
1102 &OfflineIMAP; starts up (relating to ConfigParser or
1103 AccountHashGenerator) and the
1104 configuration file. This is because the config file format
1105 had to change to accommodate new features in 4.0. Fortunately,
1106 it's not difficult to adjust it to suit.
1107 </para>
1108 <para>
1109 First thing you need to do is stop any running &OfflineIMAP;
1110 instance, making sure first that it's synced all your mail.
1111 Then, modify your
1112 <filename>~/.offlineimaprc</filename> file. You'll need to
1113 split up each account section (make sure that it now starts
1114 with "Account ") into two Repository sections (one for the
1115 local side and another for the remote side.) See the files
1116 <filename>offlineimap.conf.minimal</filename> and
1117 <filename>offlineimap.conf</filename> in the distribution if
1118 you need more assistance.
1119 </para>
1120 <para>
1121 &OfflineIMAP;'s status directory area has also changed.
1122 Therefore, you should delete everything in ~/.offlineimap as
1123 well as your local mail folders.
1124 </para>
1125 <para>
1126 When you start up &OfflineIMAP; 4.0, it will re-download all
1127 your mail from the server and then you can continue using it
1128 like normal.
1129 </para>
1130 </refsect1>
1131
1132
1133 <refsect1>
1134 <title>Copyright</title>
1135 <para>OfflineIMAP, and this manual, are Copyright &copy; 2002, 2003 John Goerzen.</para>
1136
1137 <para>
1138 This program is free software; you can redistribute it and/or modify
1139 it under the terms of the GNU General Public License as published by
1140 the Free Software Foundation; either version 2 of the License, or
1141 (at your option) any later version.
1142 </para>
1143
1144 <para>
1145 This program is distributed in the hope that it will be useful,
1146 but WITHOUT ANY WARRANTY; without even the implied warranty of
1147 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1148 GNU General Public License for more details.
1149 </para>
1150
1151 <para>
1152 You should have received a copy of the GNU General Public License
1153 along with this program; if not, write to the Free Software
1154 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</para>
1155
1156 <para>imaplib.py comes from the Python dev tree and is licensed under
1157 the GPL-compatible PSF license as stated in the file
1158 <filename>COPYRIGHT</filename> in the &OfflineIMAP;
1159 distribution.
1160 </para>
1161 </refsect1>
1162
1163 <refsect1>
1164 <title>Author</title>
1165 <para>&OfflineIMAP;, its libraries, documentation, and all included files, except where
1166 noted, was written by John Goerzen <email>jgoerzen@complete.org</email> and
1167 copyright is held as stated in the COPYRIGHT section.
1168 </para>
1169
1170 <para>
1171 &OfflineIMAP; may be downloaded, and information found, from its
1172 homepage via either <ulink url="gopher://quux.org/1/devel/offlineimap">Gopher</ulink>
1173 or <ulink url="http://quux.org/devel/offlineimap">HTTP</ulink>.
1174 </para>
1175
1176 <para>
1177 &OfflineIMAP; may also be downloaded using Subversion. Additionally,
1178 the distributed tar.gz may be updated with a simple "svn update"
1179 command; it is ready to go. For information on getting OfflineIMAP
1180 with Subversion, please visit the
1181 <ulink url="http://svn.complete.org/">complete.org Subversion page</ulink>.
1182 </para>
1183
1184 </refsect1>
1185
1186 <refsect1>
1187 <title>See Also</title>
1188 <para><application>mutt</application>(1),
1189 <application>python</application>(1)
1190 </para>
1191 </refsect1>
1192
1193 <refsect1>
1194 <title>History</title>
1195 <para>
1196 Detailed history may be found in the file ChangeLog in the
1197 &OfflineIMAP; distribution. Feature and bug histories may be
1198 found in the file debian/changelog which, despite its name, is
1199 not really Debian-specific. This section provides a large
1200 overview.
1201 </para>
1202 <para>
1203 Development on &OfflineIMAP; began on June 18, 2002. Version
1204 1.0.0 was released three days later on June 21, 2002. Point
1205 releases followed, including speed optimizations and some
1206 compatibility fixes.
1207 </para>
1208 <para>Version 2.0.0 was released on July 3, 2002, and
1209 represented the first time the synchronization became
1210 multithreaded and, to the best of my knowledge, the first
1211 multithreaded IMAP syncrhonizing application in existance.
1212 The last 2.0.x release, 2.0.8, was made on July 9.
1213 </para>
1214 <para>
1215 Version 3.0.0 was released on July 11, 2002, and introduced
1216 modular user interfaces and the first GUI interface for
1217 &OfflineIMAP;. This manual also was introduced with 3.0.0,
1218 along with many command-line options. Version 3.1.0 was
1219 released on July 21, adding the Noninteractive user
1220 interfaces, profiling support, and several bugfixes. 3.2.0
1221 was released on July 24, adding support for the Blinkenlights
1222 GUI interface. &OfflineIMAP; entered maintenance mode for
1223 awhile, as it had reached a feature-complete milestone in my
1224 mind.
1225 </para>
1226 <para>
1227 The 3.99.x branch began in on October 7, 2002, to begin work
1228 for 4.0. The Curses.Blinkenlights interface was added in
1229 3.99.6, and many architectural changes were made.
1230 </para>
1231 <para>
1232 4.0.0 was released on July 18, 2003, including the ability to
1233 synchronize directly between two IMAP servers, the first
1234 re-architecting of the configuration file to refine the
1235 notion of an account, and the new Curses interface.
1236 </para>
1237 </refsect1>
1238 </refentry>
1239 </reference>
1240
1241 <!--
1242 Local Variables:
1243 mode: sgml
1244 sgml-set-face: T
1245 End:
1246 -->