I used the mb2md script to convert mailbox files:
http://batleth.sapienti-sat.org/projects/mb2md/
I used the following small php shell script to convert all mbox files at once with the mb2md script:
Code:
<?
// This script converts the content of mailboxes in /var/spool/mail
// to mail directories
$dir = "/var/spool/mail/";
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if($file != '.' && $file != '..' && filesize("/var/spool/mail/".$file) > 0 && $file != 'Maildir') {
exec('mkdir /tmp/mb2md_temp');
$sourcefile = "/var/spool/mail/".$file;
$userid = fileowner($sourcefile);
$userinfo = posix_getpwuid($userid);
$username = $userinfo["name"];
$homedir = $userinfo["dir"];
$command = "/usr/bin/mb2md -s $sourcefile -d /tmp/mb2md_temp";
echo $command."\n";
exec($command);
$command = "chown $username /tmp/mb2md_temp/cur/*";
echo $command."\n";
exec($command);
$command = "mv /tmp/mb2md_temp/cur/* $homedir/Maildir/new/";
echo $command."\n";
exec($command);
exec("rm -rf /tmp/mb2md_temp");
exec("rm -f $sourcefile");
}
}
closedir($dh);
}
}
?>