Where does Mail keep its configuration files?

Solution 1:

Mail.app stores server credentials in your login keychain. You will find your login keychain in: ~/Library/Keychains/login.keychain

Copy, rename, and open this keychain file with Keychain Access. Keychain Access is included with Mac OS X in the Applications > Utilities folder.

Within the Keychain Access application, search for your mail server using the search field at the top-right.

To retrieve a password, double-click on the item and enable Show password:.

Solution 2:

I found the file with the account list under

~/Library/Mail/V2/MailData/Accounts.plist

It seems to hold all sorts of metadata related to accounts but if you go through it you'll find things like server names and ports.