CardDAV Synchronized Contacts

CardDav allows you to share contacts between multiple devices / computers using the CardDav synchronisation protocol.

Background

Surgemail's CardDav support uses much the same technology and techniques as the CalDav (SabreDav). At this stage CardDav is not generally enabled as it has not yet been integrated into surgeweb for contact storage, but you can fairly trivially enable it for device to device contact synchronization.

Installation Notes

1. Get CalDav running

Follow all the steps to get CalDav running and make sure it is fully operational..

2. Copy php script

copy C:\surgemail\phplib\netwin\abk.php \surgemail\scripts
  

3. Create data file

Script points to data\abkdb.sqlite (in same schema as caldb.sqlite) so either create empty suitable formatted database:

copy C:\surgemail\phplib\netwin\data\caldb.sqlite \surgemail\scripts\data\abkdb.sqlite
  

or point script at caldb.sqlite instead. This means the contacts info and calendar info is stored in same db file, which with the current surgemail setup means that carddav data is copied to the mirror server once a day too (as is the case currently with caldav entries)

4. Add settings to surgemail.ini

Add these settings to surgemail.ini and issue a "tellmail reload" if manually editing surgemail.ini.

g_url_alias from="/abk" to="/scripts/abk.php"
g_url_redirect from="/.well-known/carddav" to="/abk"
  

5. Create addressbook (if needed)

Some clients will create addressbooks on the fly, but you can create one if needed here:

http://server.domain.com:7080/abk/addressbooks/user%40domain.com

(Using your Surgemail server name and port, and your Surgemail user name, of course...)

6. Connect using your client

On iPhone / iPad (tested iOS 6) or OSX 10.7 connect to the server as:

      username: email@domain.com
      password: your_pass
      server: url or ip address of the server (eg for my test 192.168.0.10)

Further comments

1) If your client needs full carddav url I believe it is much the same as caldav. So for carddav I believe:

http://server.name.com:7080/abk/principals/user%40domain.com

2) In terms of enforced SSL, the same holds for carddav as caldav. ie if you are enforcing ssl through the use of surgemail.ini: g_ssl_require "*" you would currently need to modify this line in surgemail/phplib/netwin/NWAuth_sabre.php from "/notls" to "/ssl/novalidate-cert":

$imap = imap_open("{127.0.0.1:993/ssl/novalidate-cert}INBOX", $username, $password, OP_HALFOPEN);

Although item 2 here I expect to make automatic for the next version of surgemail.