Roundcube and Google Contacts

The Roundcube logo

The Roundcube logoOne of the reasons I use Roundcube is that when I was shopping for a webmail client, there was a plugin that provided Google Contacts integration. Unfortunately, that plugin hasn’t been updated for over a year and it has rate limiting issues. So, when upgrading my Roundcube installation to 0.8.4 I decided it had to be replaced. Updated for Roundcube 0.9.

Great. Another Roundcube-adventure.

Fortunately, Google Contacts supports CardDAV. Having a standard protocol makes the odds of finding a working plugin a lot bigger. Unfortunately, setting up CardDAV for Google Contacts takes a bit more effort. Fortunately, I decided to write those steps down, so you don’t have to figure out how to do it.

I’ve used the RCMCardDAV plugin. I could not get the latest release at the time of this writing (0.7.0) to work. YMMV, since I did change some configuration settings after seeing the better error messages provided by trunk. In any case, I used the latest SVN revision (rev 261). The repository is at https://svn.crash-override.net/rcmcarddav/. Update October 9th, 2013: RCMCardDAV now has a GitHub repository: https://github.com/blind-coder/rcmcarddav.

The installation instructions are pretty clear (refer to INSTALL for the latest instructions):

  • Unpack to <roundcube>/plugins
  • Add the name of the plugin folder to the $rcmail_config[‘plugins’] in <roundcube>/config/main.inc.php
  • Run <carddav-plugin>/dbinit/<yourdatabase>.sql in your database-tool of choice

Now all we need to do is configure a CardDAV address book in our account. First, create an application-specific password in your Google Account if you use two-step verification. Then log in to Roundcube:

  • Go to Settings → Preferences → CardDAV
  • Fill in the fields with the following information:
    • Name of the addressbook: any name you want. I used the very original “Google Contacts”. The address book should not need to exist yet. It will be created.
    • Activate CardDAV-Addressbook: keep checked.
    • Username: the full email-address for your Google Account, e.g. sjoerd@example.com
    • Password: if you use two-step verification, your application-specific password. If you don’t, the password to your Google Account.
    • URL: https://google.com/m8/carddav/ (This is notably different from the iOS CardDAV setup. Google will simply instruct you to use “google.com”. That value does not work here.) Update October 9th, 2013: If you use the latest revision of RCMCardDAV (here), you can simply enter “google.com”. RCMCardDAV now has service discovery. (Tested with Roundcube 0.9.)
    • Update interval (hours): I kept it at “1”. Do as you like.
  • Save

And that’s it. If you go to Address Book, you will see a new address book called “Google Contacts (default)”. Give it a moment if your contacts haven’t shown up yet.

RCMCardDAV stores two log files in your Roundcube log directory (<roundcube>/logs): carddav and carddav.warn. If you have any problems, those two files should be the first place to look if you have any problems. If the files don’t exist, no log messages have been written to it.

Update October 9th, 2013: Updated for Roundcube 0.9 and latest revision of RCMCardDAV.

Update June 17th, 2014: Larry Rosenman writes: “if you have a lot of contacts (I have 4600+), you may need to adjust the timeout in carddave_common.php from 10 to something bigger. I used 120.”

Update August 7th, 2017: John Simmonds writes:

I thought you might like some information for updating your page with reference to Roundcube v1.2-beta using 2.0.4. of carddav on Ubuntu 16.04LTS.

I’ve installed Roundcube using “apt-get install roundcube rounndcube-plugins, roundcube-plugins-extra“, so Ubuntu has spread the installation around the file system a bit.

First it seems we can’t get any joy until we login to google, select My Account, Sign-in & security and then and enable less secure apps from the bottom of the page.

We now no longer need to create a database for carddav, that’s done for us when a user logs into Roundcube.

So the procedure I followed was:

cd /tmp;

wget https://github.com/blind-coder/rcmcarddav/releases/download/v2.0.4/carddav-2.0.4.tar.bz2;

Ubuntu puts roundcube plugins in /usr/share/roundcube, then links to them from /var/lib/roundcube

cd /usr/share/roundcube/plugins;

tar jxvf /tmp/carddav-2.0.4.tar.bz2;

chown -R root:root /usr/share/roundcube/plugins/carddav;

ln -s /usr/share/roundcube/plugins/carddav /var/lib/roundcube/plugins/carddav;

Configuration files on Ubuntu live in /etc/roundcube, so we’ll copy the config.inc file there, and then link to it.

mkdir /etc/roundcube/plugins/carddav;

cp /usr/share/roundcube/plugins/carddav/config.inc.php.dist /etc/roundcube/plugins/carddav/config.inc.php;

ln -s /etc/roundcube/plugins/carddav/config.inc.php /usr/share/roundcube/plugins/carddav/config.inc.php;

Now edit /usr/share/roundcube/plugins/carddav/config.inc.php, add the following line in the appropriate place to make passwords more secure:

$prefs['_GLOBAL']['pwstore_scheme'] = 'encrypted';

Then edit /etc/roundcube/config.inc.php and find the $config['plugins'] section and add the following to it

'carddav',

And that’s it.

Then login to Roundcube as you describe, click on settings, then select CardDAV section, and configure:

  • Name of addressbook: Google Contacts
  • Username: <google email address>
  • Password: <google password>
  • URL: google.com

Click save.