Kolab’s CardDav address lookup in Mutt

This should work with any carddav server, but if you use Kolab’s carddav server here’s some extra tip!

The problem you want to fix is: it’s impossible to remember everyone’s email address. This problem is solved by most email programs because they are linked to a contact list already. However, for those of us using Mutt, there’s no full contact integration so you need to rely on something else.

One obvious solution is to rely on a mail indexer to search and find addresses in emails from the past. If you use mu, here’s how Karsten does it.

However, that’s not really helping if you have contact information from multiple sources (e.g. typing on your mobile the email address of somebody you just met AFK). This is where a contact server is handy.

If you use Google’s contacts, you can use goobook it works well but it’s quite slow IMHO. And obviously, the problem is that you have given up your whole contact list to Google.

Find your Kolab addressbook

With Kolab 3.1 comes a CardDav/CalDav/webDav server! Version 3.1 was just released today. So let’s use that instead.

  • When I set up Kolab 3.1 before the official release, I got a packaging bug in CentOS, but it’s easy to fix.

  • The *Dav server is located at https://kolab.example.org/iRony. Now, you need to find how to link to a specific addressbook. I tried to have a look at the Roundcube interface, for a folder id or something, but I could not find any that was working.

  • Just connect a webDav client (in Nautilus, File > Connect to a server) to the iRony folder, and then just navigate to find the addressbook identifier (look in the address bar!)

Hopefully, this will soon not be needed any longer. There will be a “Show address book URL” setting directly in Roundcube’s contacts menu.

Sync your CardDav addressbook with pyCardDAV

Now install pyCardDav which just landed on Debian last month:

# apt-get install pycarddav
  • Sync pycarddav after you entered the Kolab addressbook resource in the config file with pycardsyncer

    I advise you run this with --debug to make sure that it does not get stuck in case you have some illegal characters inside one of your vCards. If it gets stuck, then you can just go back to your webDav client and edit the file that’s causing trouble.

  • If all goes well, you should be able to search for contacts inside your local copy:

    % pc_query hugo
    searching for hugo...
    Name: Hugo Roy
    TEL (CELL): +...
    EMAIL (INTERNET\, WORK): hugo at fsfe dot org

Lookup directly from Mutt

I just added this to my ~/.muttrc:

set query_command="pc_query -m '%s'"
bind editor <Tab> complete-query

That way, in Mutt, just type β€˜Q’ to search for a contact. Or you can also press β€˜m’ to start a new message, start typing in the β€˜To:’ field the name of your contact and just press [Tab] to have autocompletion!