With Kathy being away I thought I'd have a look at setting up webmail so she can get hold of her mail easily whatever setup she ends up with. My only experience so far is sqwebmail but it's not that great UI-wise and ties to Maildir. This is good because it means it's lightweight, but I figured if I was investigating systems I should keep Black Cat (who currently use sqwebmail along with various other bits of Courier) and the (which is largely mbox at present) in mind.

apt-cache search webmail produces a list of things to try. My heart sinks as I realise lots of them require PHP. And others want MySQL. I go and have a look at Prayer, which I've vaguely prodded before. It's not packaged, but I decide to try it out. It builds easily enough, I wrestle with roughly packaging it up into a deb to make removing it less hassle and install it. It doesn't like my earth.li CA signed cert on localhost. I eventually find the novalidate-cert option and manage to connect.

My home box runs dovecot with Maildirs. This leads to my next problem; Prayer wants to create a folder called .prayer for it's config info. This doesn't work with Maildirs as folder directories tend to start with a . Changing it to prayer-config fixes that, though leaves it visible in the web interface. It's possible I can hide it if I look harder.

So, I'm ready to send a mail. I do so. It gets delivered (modulo me remembering not to try to send from my internal domain to the outside world). A sent-mail folder gets created. Prayer failed to show any messages in it. I verify there is a message there by looking on the filesystem. I curse. I try creating another folder and sticking a message in it. No joy. I try Prayer against a Courier server. Same thing; it shows the mail folders as directories but no messages. I try it against a Dovecot server with mailbox. It works fine. I curse some more.

At this point I decide the statement "Consequently, the user interface distinguishes between mailboxes and directories: this will not work well with servers which provide dual use mail folders." on the Prayer website should be heeded. So I decide to try postman, which the Prayer docs suggest they'd have used if it had been around when they started (it also does persistant IMAP connections with a backend daemon). I give up once I actually start trying to figure out the config file and how it all fits together.

So. Out come the IMAP RFCs. I attempt logins to the different servers I have access to and I find that the mbox server reports \NoInferiors for mailboxes while the maildir server reports [\=HasNoChildren]. And that \NoInferiors implies [\=HasNoChildren]. So I hack Dovecot to always return \NoInferiors. And it works and I can see messages in folders. Yay. But hacking dovecot is annoying and won't help me with Courier. Leading to the following patch to Prayer:

--- prayer-1.0.18.orig/prayer/dirlist.c
+++ prayer-1.0.18/prayer/dirlist.c
@@ -172,7 +172,8 @@
     dl->next = NIL;
     dl->name = pool_strdup(callback.pool, name);
-    dl->isdir = (attributes & LATT_NOINFERIORS) ? NIL : T;
+    dl->isdir = (attributes & (LATT_NOINFERIORS | LATT_HASNOCHILDREN)) ?
+               NIL : T;
     /* Insertion sort algorithm */

ie if there are no child folders we assume the current folder is a mailbox rather than a directory.

Now to actually run it for a while and see if it does the job.