Mail stores most preferences and all account settings in
~/Library/Preferences/com.apple.mail.plist. Everything else, including all your messages and mailboxes, is stored in
~/Library/Mail. Copying these (the preferences file and the
entire Mail folder itself, not just its contents) from one computer to the other is all you need to do in order to have an exact copy of all your messages, mailboxes and Mail settings on both computers.
In order to avoid potential permission issues, copy the files operating on the destination computer and while logged in as the user that's going to use those files. Also, be sure Mail isn't running on either computer while copying those files.
Alternatively, if what you really want to do is merge the mail stored on one computer with whatever mail is already stored on the other, then
File > Import Mailboxes should be used instead.
DON'T try to synchronize mail between computers with a file synchronization utility. Mail keeps a reference to every message within the
~/Library/Mail/ folder in a global
Envelope Index file. If this file is modified in more than one computer between synchronizations, there is no way a file synchronization utility can handle the situation properly.
Another, more subtle, and potentially more dangerous issue, is that Mail may use different
*.emlx sequence numbers to name the same message in different computers or, worse yet, the same sequence number to name different messages in different computers. Again, the only thing a file synchronization utility can do about it is either overwrite files with the same name (thus potentially losing data) or not synchronize them at all.
Mail data "synchronization" at the filesystem level can only be done reliably if it's a
one-way operation, i.e. if the
entire contents of the Mail folder in one of the computers are overwritten by the entire contents of the other.
This is not a Mail thing. You would encounter similar issues with any other mail client because there is no way you can avoid the same files being modified on both computers if you use both between synchronizations. The only reliable way to achieve mail synchronization between computers is using an IMAP account and storing mail on the server -- that's precisely what IMAP is for.
Note: For those not familiarized with the ~/ notation, it refers to the user's home folder, i.e. ~/Library is the Library folder within the user's home folder.