Periodic notification of received mails processed by dovecot’s sieve

I’m using dovecot’s sieve to filter incoming mail into different folders. As this works in the backround (through fetchmail + procmail + dovecot’s deliver), I may not know that new mail is available until I check in Gnus or notmuch.

So I’d like to be notified by notification popups in my Gnome desktop (I’m using gnome3’s fallback session, FWIW).

I’ve added the following crontab (crontab -e) :

* * * * * ~/bin/dovecot-logs-stats.sh

This is a shell script that will check the new lines added to dovecot’s sieve log file, counting how much new mails have been added in each folder.
Continue reading “Periodic notification of received mails processed by dovecot’s sieve”

Migrating mail from Evolution local storage to Evolution + local Imap (dovecot with Maildir) 2/X

See previous post for the rationale.

I’ve then started migrating my mail using evolution.

First I’ve installed dovecot and set it up so as to store my mail inside my $HOME/Maildir/ dir. Evolution will run dovecot on demand through a pipe, instead of through network access like with regular remote IMAP servers. So dovecot won’t be started as a daemon. I’ve been inspired by Roland’s setup for this (even though I’not using offlineimap).

Inside Evolution, I’ve configured a second mail profile, for this local IMAP server, using the custom command to connect to server :
"MAIL=maildir:$HOME/Maildir /usr/lib/dovecot/imap"

I’ve migrated my existing mail folders using “copy to” function on all top-level mail folders from the local evolution storage, to copy them to the IMAP folders. Note that some folders that include a dot (‘.’) need to be renamed, as the dot is a path separator for IMAP.

I’ve adapted Evolution’s vfolders definitions so as to take into account the “active remote folders” instead of the local ones, and that’s it, the mail is migrated.

I’m using fetchmail + procmail to fetch mail from remote servers and to deliver it to the Maildirs, using dovecot’s deliver program, with something like :

DELIVER="/usr/lib/dovecot/deliver"

:0: w
| $DELIVER

I’ve migrated the filters of evolution to “server-side” Sieve rules so that dovecot’s deliver sorts incoming mail in the right Maildirs. The dovecot config needs to be adapted to activate the sieve plugin (dovecot-sieve Debian package), in /etc/dovecot/conf.d/15-lda.conf :

protocol lda {
# Space separated list of plugins to load (default is global mail_plugins).
mail_plugins = $mail_plugins sieve
log_path = /tmp/dovecot-deliver-errors.log
info_log_path = /tmp/dovecot-deliver.log
}

The original Evolution filters rules were stored in $HOME/.config/evolution/mail/filters.xml, so I wrote a quick python DOM parsing tool to extract the (long) list of definitions and generate Sieve rules for the $HOME/.dovecot.sieve config file (in which folder hierarchy uses a ‘.’ path separator instead of a ‘/’).

The sieve-test program can be used to check is sieve rules function as you want.

Now this is all setup, I only need to configure notmuch to index all the Maildirs. But this is left to another post.

Migrating mail from Evolution local storage to Evolution + local Imap (dovecot with Maildir) 1/X

I’ve been fed up with Evolution being so buggy and slow, which was making managing my mail ever more painful as time passes. Still, one of the advantages of Evolution over other MUAs is the vfolders feature, which I’ve been using intensively for years. Would there be some alternate way of managing my mail ?

I’ve been reading about notmuch‘s progress in becoming a very powerful mail management / retrieval tool (it could very well replace the vfolder feature of Evolution), but unfortunately, it is not (yet) integrated with Evolution.

Others have documented their mail setup, and it seems that I could achieve a middle ground solution by migrating all my mail folders, currently stored inside Evolution’s local storage, into Maildir folders managed by a local dovecot IMAP server. Evolution would still be my MUA, but it would store my mail inside Maildirs through dovecot. I’ve been told that Evolution may be less buggy with IMAP than with local folders, which could solve my main annoyances. Also, it would make it possible to index mail with notmuch, as it supports the Maildir storage format.

I’ve then decided to take the opportunity of a holiday period to start the migration attempt.

I’ll document it in another post.