MozillaZine

Moving address books between profiles

From MozillaZine Knowledge Base

The address books that you use with Thunderbird or Mozilla Suite are by default stored in your profile folder. The two default address books are called "Personal Address Book" and "Collected Addresses" and are stored in "abook.mab" and "history.mab" files, respectively. Other address books that you create will also be named with the ".mab" extension, such as "abook-1.mab" or "abook-2.mab".

Moving address books to another profile

The two default address books ("abook.mab" and "history.mab") can be copied directly from one profile folder to another, overwriting the associated file. Thunderbird will automatically recognize these address books when it starts up and you will be able to use them right away.

Other address books (such as "abook-1.mab") can not be copied from profile to profile this way because by default Thunderbird only knows about the "Personal Address Book" and "Collected Addresses" address books. To move other address books you need to both copy the file and update the prefs.js file to tell Thunderbird about the new address book. They are two ways you could do this for each address book.

Method 1: Import an existing *.mab file using the MoreFunctionsForAddressBook add-on (recommended)

If you are moving a *.mab file from one Thunderbird profile to another the simplest way is to use the MoreFunctionsForAddressBook extension to import the address books (as is, without having to convert them). It will copy the files and update prefs.js.

Method 2: Export an address book as a .LDIF or .CSV file and then import it.

  • Start Thunderbird using the profile whose address books you want to move.
  • In the Address Book window, select the address book that you want to export.
  • Go to the "Tools" menu and select "Export...".
  • Enter a name for the address book, select "LDIF" from the drop-down list, choose where on your computer you want to save the address book, and then click to save the file.
  • Switch to the other profile. If you're using the same computer for both profiles you could do this using either the profile manager, profile switcher add-on, or using a -profile command line argument if you are launch Thunderbird using a windows console.
  • Import it in Thunderbird, using Tools -> Import -> Address Books -> Text files.

If it's not possible to export the address book you could use a utility such as Dawn to convert the .MAB file to a .LDIF file. It also knows how to convert several other formats.

Recovering address books from a damaged profile

In the unfortunate event that your profile is damaged, it is possible to recover your address books, even if the profile itself is unusable. Of course you have made regular backups which you can simply import, but just in case you hadn't... read on.

First, copy the damaged profile, or at least the ".mab" files, to a safe place. Next, you will have to make a new profile, configure your accounts and preferences, etc. Start Thunderbird and go to the address book. Create some new address books ("File -> New -> Address Book"). Create as many address books as you had in the damaged profile, and give them names like "AB1", "AB2", ...

Now exit Thunderbird, and go to the new profile folder. You will see files with names like "abook-1.mab", "abook-2.mab", with small file sizes, because they are empty. Copy the saved ".mab" files from the old, damaged profile into the new profile. For each ".mab" file from the old profile, there should be a file with the same name in the new profile. If there isn't, rename the old file, giving it the name of a new file which is not used yet.

Start Thunderbird again, and go to the address book. If all is well, the newly created address books are filled with the contents of the old ones. You can now change the names "AB1", "AB2", ... into something more meaningful by right-clicking on each address book and choosing "Properties".

Of course, if your old address books have been damaged, this procedure will not help.

Backing up your address books

It is recommended that you regularly make backups of all your Thunderbird application data, including mail files, address books, and account settings, so that you can restore your complete profile(s) if it becomes necessary.

In addition, you may want to occasionally make separate backups of all your address books by exporting them as LDIF files. That way, if your address books ever happen to become corrupted, you will still have a separate backup that you can import into any Thunderbird profile. To do so, export each address book as an LDIF file using the procedure described above and then burn the LDIF files onto a CD-ROM or store them elsewhere for safekeeping.