Manitou-Mail Home

3. Importing existing mail archives

Mailboxes in mbox format can be imported directly with the --mboxfile option. Otherwise, collections of mail files inside directories (maildir or MH formats) can be imported with --import-list.

3.1. Import mailboxes in mbox format

$ manitou-mdx --conf=/path/to/config_file --mboxfile=/path/to/mboxfile \
  [--tag=tagname] [--status=1] [--mailbox=name@example.com]

The --tag option will create the tag if it doesn't exist already, and assign it to every imported message from that mailbox. For a sub-tag (that is not at the top level of the tags hierarchy), the syntax to use is parent->subtag. The --status=1 option has the effect of marking the imported mail as already read, otherwise it will be considered as new. A status of 33 (32+1), meaning read and archived, may also be used. Optionally, the --mailbox argument can be used to specify to what mailbox the messages should be assigned. An entry for this mailbox will be created in the database, if it doesn't preexists.

3.2. Importing MH or maildir-like archives

Archives whose format use one file per message are processed by first creating a file with the list of mail files to import (one file per line), and then importing from that list. The exact command to create the list of files may vary between systems and depend on the directory layout of the archive. For instance, files from a dovecot maildir archive might be collected with:
$ find INBOX -type f \! -name 'dovecot*' >  /tmp/list

Inside the list, the file names may be designated by a relative path. The import-basedir option can be used to specify the directory into which the files reside. This base directory can be a full path or relative to the current directory. If it's not specified, then the file names in the list are also interpreted relatively to the current directory.

$ manitou-mdx --conf=/path/to/config_file --import-list=/path/to/list \
  [--import-basedir=/path/to/directory] \
  [--tag=optional_tagname] [--status=1] [--mailbox=name@example.com]