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