Updated. New details added.
I got fed up with Evolution recently. My main beef with it is that it's all about magic on the back end. All sorts of details, such as what you've deleted or what you've marked as spam are flagged using proprietary metadatabases. The persistence of this information also seems to be dodgy, which means that often, when Evolution crashes it forgets such details, and makes you re-delete, re-file and re-flag things. To make this worse, Evolution crashes a lot, and it seems to especially crash after you've done a lot of message deleting and moving. Over time, Evolution has cost me a lot of tedious work (I get a lot of spam and throwaway mail) and I got to the point where I could no longer stand a tool that increased my workload for little gain.
The main reason I stuck with Evolution for so long is that I have used the MH system to manage my mail for a long time. I like the idea of one message per file. Evolution was the only very modern MUA I could find that supported MH folders. I'd used EXMH for a long time, but it's showing its age, and Sylpheed-claws has way too many rough edges.
So it was time for a change on my Ubuntu workstation, and this is just my notes about what it took to complete the switch of mail management systems.
MH to Maildir
In the end I decided to switch to Maildir, which is like MH in its one-file-per-message philosophy, but seems to be supported by more modern MUAs. I also decided to hedge my bets by moving to a local IMAP server to expose the Maildir folders to just about any MUA.
For the main conversion I used Dr. Jürgen Vollmer's mh2maildir. It did the trick very well. All my MH folders were stored in a directory Mail
, and I wanted to have the resulting Maildir in .maildir
. I invoked the script as follows:
./bin/mh2maildir.sh -r -R ~/Mail/ ~/.maildir
I knew I had no unread e-mail, thus the -r
option. Most users will need the -R
option. The original MH diectory is left alone, as far as I can tell, but of course I always recommend backing up your mail folders before any bulk action.
Update. You may need to make some structural adjustments in the resulting .maildir folder. Firstly, many MH tools use an explicit folder named "inbox", which is thus converted into a Maildir folder named "inbox". Most Maildir tools, however, treat the top folder as the implicit inbox. I addressed this as follows:
cd ~/.maildir mv tmp tmp.save mv inbox/* . rm -rf inbox
Also, some Maildir tools such as Mutt and Dovecot expect to see folders as hidden filees (with a leading dot). I handled this by renaming folders, for example:
mv Writing/ .Writing/
If you have nested folders, you have to use a dot to separate levels. A folder "eggs" within "spam" is represented by a top-level directory called ".spam.eggs". I had to do the likes of:
mv XML/XML-DEV .XML.XML-DEV mv XML .XML
Of course leave alone the "cur", "new" and "tmp" directories which make up the internal structure of each Maildir folder.
Dovecot for IMAP
I went with the Dovecot server for IMAP. I just used Synaptic to install dovecot-common and dovecot-imapd, and followed the article "Setting up an IMAP server with dovecot". The trickiest line in setting up /etc/dovecot/dovecot.conf
seems to be the default_mail_env
.
default_mail_env = maildir:/home/%u/.maildir
Update. I also had to enable imap with the lines:
protocols = imap imap_listen = *
And for some reason I had to manually start dovecot the first time:
sudo dovecot
After this, the usual sudo /etc/init.d/dovecot restart
seems to work.
Thunderbird
The thunderbird set-up was very straightforward. In fact, I can't really think of anything to say about it. Just set it up with localhost as an IMAP server, and you're set.
Finally, updating .fetchmail
I use fetchmail to download my mail from my external IMAP server, and procmail to put it into my local folders. I had to change procmail to work with Maildir rather than MH folders. The changes turned out to be very simple. In my .procmailrc having defined MAILDIR=$HOME/.maildir
I changed lines such as
|/usr/lib/mh/rcvstore +Writing
to
$MAILDIR/.Writing/
Nested folders are similar. You use periods rather than slashes for level separators, not forgetting the leading period. Thus
|/usr/lib/mh/rcvstore +Writing/Tech
becomes
$MAILDIR/.Writing.Tech/
Since Mutt/Dovecot don't use explicit "inbox" folders,
|/usr/lib/mh/rcvstore +inbox
becomes just
$MAILDIR/
The trailing slashes are essential. They indicate that the destination is a Maildir folder and so procmail does the right thing with it.
Mutt is useful for testing that all is OK with your IMAP set-up. Use regular slashes rather than periods for folder separators in IMAP urls, for example:
mutt -f imap://uogbuji@localhost/Writing/Tech