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