I've been asked a few times in the last two weeks how to move all of the mail in Snow Leopard to a clean install of OS X Lion. The actual process isn't difficult; it's the same one I've been using for a while with our own Macs for a clean install of Leopard, Snow Leopard, or Lion.
The process involves moving the Mail preferences, the Mail files, and the Apple Keychain, which hold the passwords for your various email accounts.
Of course, to actually move the Apple Mail accounts and data over, you need a working copy of Snow Leopard. If you have already erased the drive that housed your Snow Leopard version of Mail, then you are in for a much more difficult process, one that requires you to restore Snow Leopard and Mail from a backup. But assuming Snow Leopard and your old Apple Mail files are still intact, here are the basics for moving all the relevant data to your clean install of OS X Lion.
Transfer Your Apple Mail to a New Mac
You may also find this list of how to move important Mac data from one Mac to another helpful in your move to OS X Lion:

sorry but this doesn’t work for lion
just to copy the files and folders from SL to Lion won’t do the trick!
actually “just” copying the following files (e.g. from a snow leopard backup) prior to first opening mail.app in lion works:
1) folder “Keychains”: ~/Library/Keychains/
2) folder “Mail” and “Mail Downloads”: ~/Library/Mail*
3) mail preferences file: ~/Library/Preferences/com.apple.Mail.*
then open mail.app in lion, import/update will follow
if you have opened mail.app prior to the above steps these files have already been created, so you have to replace them with your backups from snow leopard described above
if you have set up emails accounts in system preferences “Mail, Contacts & Calendars” you might have to delete them before applying the above steps
similar “solution” for how to import ical from snow leopard to lion:
1) copy the following files (e.g. from a snow leopard backup) prior to first opening ical:
1a) ~/Library/Keychains/ (folder “Keychains”)
1b) ~/Library/Calendars (folders “Calendars”)
1c) ~/Library/Preferences/com.apple.iCal.* (ical preferences files, “com.apple.iCal.helper.plist”, “com.apple.iCal.plist”)
1d) ~/Library/Preferences/iCalExternalSync.plist
2) then open ical in lion … import/update will follow
if you have opened ical prior to the above steps these files (1b, 1c and 1d ) have already been created, so you have to replace them with your backups from snow leopard described above
if you have set up calendar accounts in system preferences “Mail, Contacts & Calendars” you might have to delete them before applying the above steps
I would like to add … if you have a V2 folder on Lion:
- Delete the V2 folder first, only then Mail.app will start with the “Oh, you have previous mail, I will update …” process.
Best Regards,
Henrich