Converting VCARD to LDIF

So, you want to export all your addresses from evolution (which I use at work) and to import those addresses into your Mozilla Mail (or Thunderbird) at home. Once again, the software really bites. Evolution is too damn retarded to export anything else than VCARD (VCF) files. Mozilla Mail can import CSV (comma-delimited) or LDIF files.

Fortunately, there’s vcf2ldif. It’s far from perfect, but it’s miles better than nothing. Oh, BTW, this will probably segfault on your evolution VCARD file. I bashed its head in with my trusty gdb (a “debugger” to the less refined readers) and this patch is the result.

10 thoughts on “Converting VCARD to LDIF”

  1. Do you know where to get the vCard library (without which it won’t compile)? I searched Google for the vCard SDK extensively, but can’t find it anywhere…

  2. When you download the vcf2ldif tarball and untar it, you’ll see that it has a imc-vcardsdk subdirectory as well. This is the vCard library. So, the following should do the trick:

    tar xzvf vcf2ldif.tar.gz
    cd vcf2ldif/imc-vcardsdk
    cd ..

  3. Thanks. I’d missed that one.

    Trying the program, it’s a little sad though: It only puts the names into the LDIF file, no eMail-addresses, no other addresses, no nothing. Oh well…

  4. Hmmm, strange. I had somewhat better results with this. I definitely got the email address in the ldif file as well.

    However, because it was still quite disappointing, I now sync with jpilot every so often and then export an LDIF file from jpilot. This imports perfectly into Thunderbird with ALL relevant information.

  5. I’ve tried this script and have gotten this annoying error:
    File “./”, line 77
    IndentationError: expected an indented block

    no idea what i’m doing. any help greatly appr.

  6. It runs fine here… how did you download the script? Have you loaded it into an editor of any kind? Some editors can do really brain-dead things with white space and Python is of course very strict when it comes to indentation.

    Try to re-download the script and run it *without* loading it into any editor.

  7. Thnx for the help, but moments after I posted, I re-downnloaded the script as a text file (as opposed to copy pasting into vi) and the script ran fine once the whitespace was in order.


  8. Many people have had success with this vCard to LDIF program:

    jar and source at:

    I patched it from the original source to be more robust, and handle more formats and character encodings, and better base64 encoding support.

    It works well with the most common 2.1 and 3.0 vCard options, and is optimized for Thunderbird imports. Tested and working well with vCards from Apple Mail, and Palm desktop, on OS X and Windows, although, it has never been tested on evolution’s vCard format.

    Comments are done properly, and is “character encoding” safe.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.