Someone recently asked me if it’s possible to backup the address cache that Mail.app uses to auto-complete address fields. This is a pretty good idea since it may contain several addresses that one might be using, but has never added to the Address Book.
This information is stored inside Envelope Index, a file in your Library/Mail folder. Luckily, Apple made the wise choice of using SQLite as the DB backend (maybe Mail.app uses CoreData?) here, making backups trivial:
sqlite3 "~/Library/Mail/Envelope Index" ".dump addresses" > ~/Desktop/backup.sql
You would then use the .load metacommand to restore the address cache. The cache contains every email address that Mail.app has seen (73 460 here), including spam addresses. Just something to keep in mind.
While researching this, I also ran across a tip about using sqlite’s vacuum command to speed up Mail.app. After doing this:
sqlite3 "~/Library/Mail/Envelope Index" vacuum
My Envelope Index went from 29MB to 21MB and switching between mailboxes does seem a bit snappier.