Skip to content

Development: Maildir Root

Gaute Hope edited this page Mar 23, 2014 · 3 revisions

The maildir-root source is an experimental source keeping sup labels in sync with maildirs, so that adding a label will result in copying the thread to the corresponding label. This will make sup labels show up in GMail and it will organize labels in folders for regular IMAP.

Testing

The source is currently available in the maildir-root branch. Please back up mail and configs before trying.

Setup

The original discussion is available here: http://rubyforge.org/pipermail/sup-devel/2013-November/thread.html#1455

Where also an example setup was provided: http://rubyforge.org/pipermail/sup-devel/2013-November/001458.html

The steps include (starting with a fresh index and sup config):

  1. Set up offlineimap to sync your full IMAP tree with a similar config as above (also some details below):

    • utf7 to utf8
    • sub dirs are separated by a .
  2. Run sup-config and/or add the root folder of your maildirs using sup-add

  3. Edit sources.yaml so that the special folders (inbox, archive, spam, deleted) have the correct maildir name

  4. Enable the experimental source and maildir creation in sources.yaml.

  5. Run sup-sync or start sup to sync email and labels.

Detailed description

It is based on the maildir-syncback code, but goes further: you only specify a root folder with maildirs to the source, then each sub folder (maildirsub) is mapped to a label. Some of the labels are special: like deleted, inbox and archive (the special-label to maildirsub mapping can be specified in the source configuration).

This means that a sup label corresponds to maildir inside the maildir-root and the behavior works like this:

  • (remote to local) if a message is found in a maildirsub that label is added to it.
  • (remote to local) if a message is removed from a maildirsub that label is removed (unless it has just been moved).
  • (local to remote) if you add a label the message is written to that maildirsub (of all the maildir-roots the message belongs to)
  • (local to remote) if you remove a label from a message the message is deleted from that maildirsub. if it is deleted from all maildirsubs it is copied to the archive maildirsub.
  • (local to remote) if you archive a message it is removed from the inbox maildirsub, if it doesn't belong to any other labels/maildirsubs it is copied to archive.
  • (local to remote / remote to local) the same flag features as maildir-syncback (done on all copies in all maildirsubs)
  • (local to remote) if you add a label to a message and the message belongs to a maildir-root where no corresponding maildirsub exists a maildir will be created for it.
  • (local to remote) new messages are always ensured to be in the archive source unless they are deleted or spam

It works fairly well on gmail (label sync), but I am also using it on regular IMAP servers (here it might, in the future, be useful to always keep a copy in archive).

I am using this with OfflineIMAP and utf-7-imap to utf-8 conversion. It is probably necessary to do a full sync every time to make sure things stay in sync. Remember that it is technically possible to still do changes to the maildir while offlineimap is syncing, I haven't had any problems with this (except read flag), but it is potentially a little careless.

Clone this wiki locally