Complete.Org: Mailing Lists: Archives: offlineimap: October 2003:
Re: IMAP to mbox
Home

Re: IMAP to mbox

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Micah Anderson <micah@xxxxxxxxxx>
Cc: offlineimap@xxxxxxxxxxxx
Subject: Re: IMAP to mbox
From: John Goerzen <jgoerzen@xxxxxxxxxxxx>
Date: Tue, 14 Oct 2003 16:28:16 -0500

On Tue, Oct 14, 2003 at 10:08:39AM -0700, Micah Anderson wrote:
> Using offlineimap it seems as my only option is to pull the mail down
> into Maildir format. Unless I am mistaken, this means I cannot

You have two options:

1. Store mail in Maildir format locally;
2. Run a local IMAP server and have OfflineIMAP do an IMAP<->IMAP sync

Option 2 is specifically in there for people like you have want to use a
local format other than Maildir.

However:

> transition from my mbox format boxes without either converting all my
> local mail to Maildir format (using mb2md), or by doing it by hand in

I highly recommend you do this.  Maildir is a better format in many
different ways, and syncing IMAP<->Maildir is faster and more reliable than
IMAP<->IMAP or, for that matter, IMAP<->mbox.  Here are some reasons why
Maildir is better:

 * Metadata about the message can be stored outside the message.
   This includes message flags and UIDs for OfflineIMAP.

 * The start and end of a message are simply the start and end of a file.
   With mbox, rules are ambiguous, differ from program to program,
   can often require munging of the text of the message itself if it has
   any lines that begin with "From ".

 * Maildirs require no locking, so they can be used reliably across NFS.
   (Or at least as reliable as NFS gets.)  This also means that you can, for
   instance, keep reading your mail even while OfflineIMAP is syncing it --
   and that OfflineIMAP can process multiple messages at once.  (OK, that's
   technically possible with mbox, but *far* more difficult.)

 * mbox folders are not necessarily reliable in the face of a crash while a
   mail reader or synchronization program is writing to the folder, or
   during any type of delete.  That is, if the program or computer crashes
   while these actions are taking place, the mbox may be left in an
   inconsistent state and may lose mail.  Maildir folders do not have this
   problem; the crash can either occur before a message gets deleted or
   after, the the worst that can happen is the last few actions you took
   don't get saved.

> mutt, or is there a value I can set to the "Type" variable to save my
> messages locally in mbox format, which would allow me to put all my
> existing mboxes in the right spot, launch offlineimap for the first
> time and then everything would get sync'd up?

OfflineIMAP has no built-in support at all for mbox.  You have to either use
Maildir or an IMAP server locally.

> I have a list of folders I want to pull down, and a regular expression
> that I want to use for a number of folders, I tried various formats
> but could not get this to work:
> 
> folderfilter = lambda foldername: foldername in ['re.search('(INBOX.sent-mail)
> foldername)', 'INBOX', 'INBOX.Spam', 'INBOX.othermail']

I think you might want this:

folderfilter = lambda foldername: 
re.search('^INBOX$|^INBOX\.(sent-mail.+|Spam|othermail)$', foldername)

> I can put the regular expression by itself, and all the
> sent-mail-Jan-2003, sent-mail-Jan-2002, etc. all get pulled down, but
> not the other folders, and the same going the other way.
> Syntactically, what am I doing wrong, these should work together, no?

You could also say:

folderfilter = lambda foldername: re.search(foo, foldername) or foldername in 
['foo', 'bar', 'baz']

It's a python expression that evaluates as a boolean, not as a list.

-- John


[Prev in Thread] Current Thread [Next in Thread]
  • IMAP to mbox, Micah Anderson, 2003/10/14
    • Re: IMAP to mbox, John Goerzen <=