Faisal N. Jawdat
This is an overview of how to use mbx format files for your mail spool on a UWash IMAP server, or with Pine. The document is based somewhat heavily on the installation on Obscure, so local configuration (filepaths, etc.) may vary.
Most unix systems use the mbox format to store mail folders. This format has a number of disadvantages, including slowness and lack of concurrent access (Pine users may recognize the warning that another process is trying to access the folder).
mbx is a non-standard mail format supported by University of Washington software including the IMAP server and Pine. It is much faster than mbox, while allowing for concurrent access.
You might consider mbx format if you have a lot of mail and need faster access to the mail via IMAP, or if you need concurrent access from multiple clients (including multiple IMAP clients and local Pine installations). You should not use mbx format if your mail folders or home directory are located on an NFS volume -- mbx's support for concurrency does not work on NFS, and you risk corrupting your mail spool. You should not use mbx format if you need to read mail using any local mail reader other than Pine -- most mail readers do not understand the format.
Pine and the UWash IMAP server (whether in POP or IMAP mode) will automatically recognize and work with mbx files. This leaves the tasks of creating the files and delivering mail to the files. Most of this can be done with the
mailutil create #driver.mbx/mail/test
This command has
mailutil create a file, "test", in the mail directory, using the mbx format driver. Once the file is created, Pine and the IMAP server can work with it directly. You can move mail into it using Pine or an IMAP client.
Alternatively, you can create a file by copying mail into it using the
mailutil copy mail/foo #driver.mbx/mail/bar
This command copies the contents of the mailbox "foo" in the mail directory into a new file, "bar" in the mail directory, formatting "bar" using the mbx format driver. The copy command will not work if a file already exists.
If you're particularly comfortable with
mailutil, you can move the mail rather than copying it:
mailutil move mail/foo #driver.mbx/mail/bar
If you do not use mail filters, you don't need to worry about this section.
If you use a mail filter, you have the problem that the mail agent will attempt to deliver the mail by appending it to the end of the target folder. This will not work with mbx. Instead you will need to use the
dmail command, as with the following .procmailrc example:
:0 * ^TO_foo@bar.com |/usr/bin/dmail +mail/foo
The dmail command understands normal unix mailboxes as well as mbx files, so it's probably wise to migrate all your procmail recipies to using dmail before converting to mbx format files.
The INBOX is a special case, as the system inbox cannot be an mbx formatted file. Instead you create a special mbx formatted file called "INBOX" in your home directory, and if the file exists, Pine and the IMAP automatically move mail from the system inbox into INBOX every time they start check the inbox.
mailutil create #driver.mbx/INBOX
You should check the permissions on the INBOX file to make sure it isn't world or group readable (chmod 600 ~/INBOX).
If you run mbx-incompatible software on your mail files (e.g. sa-learn from the SpamAssassin suite), you'll need to export your mail and run the scripts on the export. You can do this by creating a temporary directory and having the script do something like:
#!/bin/sh mailutil copy mail/foo #driver.unix/tmp/foo \# [do stuff on ~/tmp/foo] rm ~/tmp/foo
mailutil command above is copying from the mailbox "foo" in the directory "mail" to a mailbox "foo" in the directory "tmp", which is formatted as a standard unix mbox file.)