[/offlineimap/head: changeset 343 jgoerzen**20030108150801 ] { hunk ./offlineimap/head/offlineimap.sgml 1 + hunk ./offlineimap/head/offlineimap.sgml 5 - hunk ./offlineimap/head/offlineimap.sgml 14 - $Date: 2003-01-08 08:48:41 -0600 (Wed, 08 Jan 2003) $ + $Date: 2003-01-08 09:08:01 -0600 (Wed, 08 Jan 2003) $ hunk ./offlineimap/head/offlineimap.sgml 561 + + + Examples + Here are some example configurations for various situations. + Please e-mail any other examples you have that may be useful to + me. + + + + Multiple Accounts with Mutt + + This example shows you how to set up &OfflineIMAP; to + synchronize multiple accounts with the mutt mail reader. + + + Start by creating a directory to hold your folders by running + mkdir ~/Mail. Then, in your + ~/.offlineimaprc, specify: + + accounts = Personal, Work + + Make sure that you have both a [Personal] + and a [Work] section, each with different + localfolder path names. Also, make sure + to enable [mbnames]. + + + In each account section, write something like this: + + localfolders = ~/Mail/Personal + + Finally, add these lines to your ~/.muttrc: + + source ~/path-to-mbnames-muttrc-mailboxes +folder-hook Personal set from="youremail@personal.com" +folder-hook Work set from="youremail@work.com" +set mbox_type=Maildir +set folder=$HOME/Mail +spoolfile=+Personal/INBOX + + That's it! + + + + + UW-IMAPD and References + Some users with a UW-IMAPD server need to use &OfflineIMAP;'s + "reference" feature to get at their mailboxes, specifying a reference + of "~/Mail" or "#mh/" depending on the configuration. The below + configuration from docwhat@gerf.org + shows using a reference of Mail, a nametrans + that strips + the leading Mail/ off incoming folder names, and a + folderfilter that + limits the folders synced to just three. + + [Gerf] +localfolders = ~/Mail +remotehost = gerf.org +ssl = yes +remoteuser = docwhat +reference = Mail +# Trims off the preceeding Mail on all the folder names. +nametrans = lambda foldername: \ + re.sub('^Mail/', '', foldername) +# Yeah, you have to mention the Mail dir, even though it +# would seem intuitive that reference would trim it. +folderfilter = lambda foldername: foldername in [ + 'Mail/INBOX', + 'Mail/list/zaurus-general', + 'Mail/list/zaurus-dev', + ] +maxconnections = 1 +holdconnectionopen = no + + + + pythonfile Configuration File Option + You can have &OfflineIMAP; + load up a Python file before evaluating the + configuration file options that are Python expressions. This example + is based on one supplied by Tommi Virtanen for this feature. + + + In ~/.offlineimap.rc, he adds these options: + + [general] +pythonfile=~/.offlineimap.py +[foo] +foldersort=mycmp + + Then, the ~/.offlineimap.py file will + contain: + + prioritized = ['INBOX', 'personal', 'announce', 'list'] + +def mycmp(x, y): + for prefix in prioritized: + if x.startswith(prefix): + return -1 + elif y.startswith(prefix): + return +1 + return cmp(x, y) + +def test_mycmp(): + import os, os.path + folders=os.listdir(os.path.expanduser('~/data/mail/tv@hq.yok.utu.fi')) + folders.sort(mycmp) + print folders + + This code snippet illustrates how the foldersort + option can be customized with a Python function from the + pythonfile to always synchronize certain + folders first. + + + + }