DBMAIL-EXPORT(8)
================
Alan Hicks <ahicks@p-o.co.uk>

NAME
----
dbmail-export - export a mailbox from DBMail to mbox format.

SYNOPSIS
--------
....
dbmail-export [options] --user username --mailbox mailbox --out file
dbmail-export [options] --user username --mailbox mailbox --basedir directory
....

DESCRIPTION
-----------
The dbmail-export program allows you to export a DBMail mailbox to an
mbox formatted mailbox.

OPTIONS
-------
-u, --user user::
  specify the owner of the mailbox you want to export, using wildcards ? and *
  to match one or none, or one or more characters in the username, respectively. 

-m, --mailbox mailbox::
  specify the mailbox you want to export.

-o, --out outfile::
  specify the file into which the exported mail will be saved.

-b, --basedir basedir::
  specify the base directory into which the exported mailboxes will be saved.

-s, --search search::
  use an IMAP SEARCH string to select messages (default: 1:\*)
  for example, to export all messages received in May, use:
      "1:* SINCE 1-May-2007 BEFORE 1-Jun-2007"

-d, --set-del-flag::
  flag exported messages as \\Deleted
  (use dbmail-util to set status to deleted).

-D, --set-del-status::
  set exported message status as deleted (use dbmail-util to purge).

-r, --recursive::
  export mailboxes recursively (default: true unless -m option also
  specified).

include::commonopts.txt[]

EXAMPLES
--------

To export and delete all messages belonging to user 'Joe' in mailbox 'Inbox'
more than 30 days old, try this command on Linux:

    dbmail-export --user joe \
        --mailbox inbox \
        --out joesinbox.mbox \
        --set-del-flag \
        --search "1:* BEFORE `date '+%e-%b-%Y' -d '30 days ago'`"

A BSD version:

    dbmail-export --user joe \
        --mailbox inbox \
        --out joesinbox.mbox \
        --set-del-flag \
        --search "1:* BEFORE `date -v-30d '+%e-%b-%Y'`"

Note the careful bash quoting and backticks calling the date(1) command.
date(1) has excellent features for retrieving relative dates. If you are
using a different shell, you may need different quotes.

To export all mailboxes named Spam for all users into individual directories
following the pattern SpamDump/<username>/Spam, try this command:

    dbmail-export --user \* --mailbox Spam --basedir SpamDump

Note the backslash to prevent the shell from expanding the *, as we want that
* to be passed into DBMail for expansion based on the internal user list.

include::footer.txt[]
