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, called "Personal Address Book" and "Collected Addresses," are named "abook.mab" and "history.mab", respectively. Other address books that you create in addition to these 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. (This includes copying them from a Mozilla Suite profile or Netscape 7 profile to a Thunderbird profile.) 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 in this way. To move these from one profile to another, you should first "export" each address book as as LDIF file and then "import" each address book into the other profile. To export an address book:

  • 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.

If its not practical to export the address book you can use a utility such as Dawn to convert the .MAB file to a .LDIF file. You can import a .LDIF address book using " Tools -> Import -> Address Books -> Text Files" and then selecting the .LDIF file(s).

You could also use the MoreFunctionsForAddressBook extension to import the address books (as is, without having to convert them).

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.

Recovering corrupt address books

Address books can become corrupt if Thunderbird crashes, or in other circumstances that the developers do not yet understand. (This is bug 366457.)

Thunderbird has renamed the old, corrupted address book to abook.mab.bak (assuming that you were using the Personal address book). It is often possible to fix this file but you need to be careful.

First, with Thunderbird closed, you need to find your profile folder. For example, if you are using XP, your profile is probably here: C:\Documents and Settings\*user name*\Application Data\Thunderbird\Profiles\*random string.profile name* The abook.mab.bak is in this folder.

If you are using Windows, before you try to find your profile, you need to set Windows to "View hidden files and folders" and to not "Hide extensions for known file types". See this for easy instructions for how to do this: View hidden files and folders.

Now, the very first thing I want you to do is to make a copy of the file. You are going to work with the copy, just in case. [Wink]

You can open the file with a text editor like Notepad or Wordpad. You want to look for any corruption and delete it. There is a lot of odd looking stuff normally that you don't want to delete. For example, this is normal: Code:


In one I worked on, a bunch of stuff like this was appended onto the file. This was corruption and needed to be removed: Code:

[2005-10-27   16:05:54    768   848   Setup   Successfully copied source file 
 C:\WINDOWS\SoftwareDistribution\WebSetup\wuauclt.exe to C:\WINDOWS\System32\
 2005-10-27   16:05:54    768   848   Setup   Setup successfullly moved C:\WINDOWS\System32\
 to C:\WINDOWS\System32\wuauclt.exe  2005-10-27   16:05:54    768   848   Setup   File operations for section wuauclt 
 completed successfully]

Once you clear the corruption, save the file as abook.mab back into your profile where you found it. You should get a message about a file of that name already existing. OK copying over it.