Notes on Thunderbird MSF files

by Martin Monperrus

I have recently dig into the *.MSF file of the Mozilla Thunderbird email client.

What is the MSF file format? It's simply a file-based Mork database. Mork is a database format that has been invented by Netscape.

How can one read such a database? Using John Constable's Mozilla-Mork (perl) or Kevin Goodsell's mork-converter (python). See below.

What does a MSF file contain? It contain one row (or record) per email. The fields (the columns) are related to email status (read, replied, ...), threads, indexing by gloda, etc. They are: x-spam-status size dateReceived subject sender message-id ProtoThreadFlags threadParent keywords threadNewestMsgDate msgThreadId threadId flags threadFlags threadSubject label statusOfset recipients threadRoot gloda-id priority msgOffset offlineMsgSize sender_name date storeToken numLines children

In Thunderbird, where is the read status of Maildir boxes stored? In the associated MSF file.

Sample Perl code to go through a MSF file (using Mozilla-Mork):

  use Mork;
  my $MorkDetails = Mozilla::Mork->new("INBOX.msf");
  $length = scalar @$results;
  print "Nb email: $length\n";
  # for each email in the database
  for (my $i=0; $i < $length; $i++) {
    my $record = $results->[$i];
    my $flags = @$record{'flags'};
    my $is_unread_status = $flags & 1;
    if(!$is_unread_status) {
      print "@$record{'storeToken'} \t@$record{'flags'}\t";
      print @$record{'subject'};
      print "\n";
    }
  }
Tagged as: