5.26.2008

Import Mail's Recent Contacts into Address Book

via MacOSXHints.com on 5/2/08
I needed to find a quick and dirty way to put all of Mail.app's stored email addresses into my Address Book. It turns out that these are stored in a SQLitev3 database named MailRecents-v4.abcdmr in ~/Library » Application Support » AddressBook/. To import these into Address Book's contact list, all I needed to do was this:
  1. Install SQLitev3 (sudo port install sqlite3 if using MacPorts)
  2. Dump the contents of the recents table to a text file with this series of commands in Terminal:
    $ sqlite3 ~/Library/Application Support/AddressBook/MailRecents-v4.abcdmr sqlite> .separator , sqlite> .output /path/to/outputput/file/Recents.csv sqlite> select * from ZABCDMAILRECENT; sqlite> .exit
  3. Now use Address Book's File » Import function to import the newly-created Recents.csv as a text file. You will be prompted to choose which fields to import as what, with the first/last names and email addresses from your recents avail...