On Mon, 13 Mar 2006, Mark Crispin wrote:
The current mbx specification is the source code, although there is some
information in the FAQ (where it discusses how to repair a damaged mbx file).
Or you can ask me a question. What is it that you need to know about it?
In general, I do not recommend writing a separate implementation of code to
support mbx format. The locking rules for mbx are complex and easy to miss.
Instead, it's better to use the c-client library.
Mark
Sorry this message is rather long.
I have taken note of your comments on file locking. I don't intend to work
on any live file that another process might want to access. I would be
making and working on private copies of the files. I also accept that I
cant blame you or your software, if my own code makes a mess of a mail
file.
I am interested in the format of UW imapd mbx files for several reasons,
including:
1) Curiosity
Does anything else use same mbx file format? With Google I get lots of
hits for tools to repair outlook express mbx files. There was also a
document on "MBX Mailbox file format" by Michael Santovec; however this is
very different to UW imapd
2) Repairing corrupt mbx format files. Hopefully this will be a very rare
event, but we would probably need to recover the persons email quickly
when it happens. I was thinking of producing some caned procedures or
scripts which junior members of the support group could use to recover
most if not all of the messages, if I wasn't around. I have since found
some repair scripts, which might help with this, including Tim Mooney's
mbx-repair.
3) One-off bulk conversion of UNIX mbox format files to mbx format.
I have used "mailutil copy" for this, however it discards, the X-Keyword:
flags it doesn't recognise (e.g. Junk, NonJunk, $Forward, $MNDSent). I had
thought of scanning a file to build a list of X-Keyword flags, and using
that to create the header for an mbx file with no messages. Then using
"mailutil append" to append the messages from the old mbox to the new mbx
file. Would mailutil recognise the X-Keyword values, if I put the flags
strings in the header and set then appropriate flags?
I have some idea about how the file format works after looking at FAQ,
examining the code; unfortunately C isn't one of my languages. I also
examined mailbox files, as I made changes via the mail client.
There still something I am unsure of.
The first 2048 bytes of the file are the mbx header, which starts with
*mbx*
ttttttttnnnnnnnn
flag-1
flag-2
flag-3
.
.
.
where
tttttttt is a time value; this doesn't seem to change, so I think it is
when the file was first created?
nnnnnnnn it the largest message UID used in the file
flag-1, flag-2, are locally defined flags. e.g. Junk, NonJunk, $Forward,
$MNDSent
The mail messages follow the header
Each message starts with a line of the form
dd-mmm-yyyy hh:mm:ss +zzzz,ssss;ffffffffFFFF-UUUUUUUU
This should be followed by a message of ssss bytes
FFFF is the standard flags, with each bit representation a flag (e.g.
1-Read, 2-Deleted, 4-Important, 8-Answered)
I assume the locally defined flags are similarly recorded in ffffffff
UUUUUUUU is a hexadecimal number, the unique ID (UID) of the message. The
messages seem to be stored in the file in UID order.
What happens if the UIDs get out of sequence or are duplicated, will imapd
replace the UIDs with new ones, in sequence or would this require outside
intervention?
Something that puzzles me, I made a new file by asking the mail client to
save messages in a new folder. The first message starts with the usual
line
dd-mmm-yyyy hh:mm:ss +zzzz,ssss;ffffffffFFFF-00000000
Next I have asked the mail client (pine via imap) to open and list this
new folder, the UID is replaced by 00000001 and a hexadecimal number has
been added after the file header and before the first message header. I am
curious, what this number does and how important it is?
Richard Westlake
School of Crystallography, Birkbeck College, Malet Street, London WC1E 7HX
Tel: 020-7631-6859
----------------------------------------------------------------------
Truth endures but spelling changes -- Anon.
----------------------------------------------------------------------
_______________________________________________
Imap-uw mailing list
[email protected]
https://mailman1.u.washington.edu/mailman/listinfo/imap-uw