The Smell of Molten Projects in the Morning

Ed Nisley's Blog: Shop notes, electronics, firmware, machinery, 3D printing, laser cuttery, and curiosities. Contents: 100% human thinking, 0% AI slop.

The New Hotness

  • Kmail to Evolution: Converting Maildir to Mbox

    A bit of searching produces this useful PHP routine, which almost worked. Two tweaks got it all the way there:

    • force the correct time zone
    • quote the write-mode parameter in fopen

    The changes, with line numbers in parens (line 347 was line 345 before the first change, OK?):

    76:  // force timezone
    77:  date_default_timezone_set("America/New_York");
    347: $this->mboxhnd = fopen($this->mboxfn,'w');
    

    After that, run the script as directed to convert the entire maildir tree in one fell swoop.

    cp -a /from-wherever/Mail/ /tmp
    cd /tmp
    php maildir2mbox.php Mail
    ll mboxfiles
    

    The output files appear in the mboxfiles directory adjacent to the top-level maildir directory. Don’t use the -e parameter, which would add a .mbox suffix to each file.

    Evolution’s import “feature” is a major pain, as you must import the converted files One. MBOX. File. At. A. Time. Sheesh.

    Rather than that, just slide the whole mboxfiles structure into place. Some case changes were in order for my setup, which may be due to historic considerations:

    • Drafts
    • Inbox
    • Outbox
    • sent-mail -> Sent
    • Spam (will become Junk in Evo)
    • Templates (not that I use any)

    Then put the mboxfiles directory somewhere on the NFS server and fiddle the Evolution directory structure:

    cp -ap mboxfiles /mnt/nfs-place/mail/
    cd ~/.evolution/mail
    mv local local.base
    ln -s /mnt/nfs-place/mail/ local
    

    Evolution will build all its indexes when it first sees the new files, so it’s all good.