We’ll assume that your email account is located on only one Mac, and that you do not yet have an email account set up in Apple Mail on the Mac you’ll be moving your email to.
Here’s how to do it:
You will need to copy some files off the Mac that already contains the email account. To do this, you can use an external hard drive or USB flash drive to transfer the files directly from one Mac to the other. Connect the drive to your Mac now.
The files are located in your User Library. Open this folder now.
Mac OS X 10.6 and earlier: Here’s where you want to go: Macintosh HD → Users → Your User Folder → Library.
Mac OS X 10.7 and later: Hold down the Option key and select Library from the Go menu.
Now you need to copy the Mail folder, as shown below. (Yes, the entire folder.) To do so, hold down the Option key and drag the Mail folder to your external drive. That will copy your mail while leaving the original files right where they are.
You should also copy the preferences file for Mail.app. Here’s where you can find it: Macintosh HD → Users → Your User Folder → Library → Preferences. The name of the file is com.apple.mail.plist.
Disconnect the external drive, and then reconnect to the new Mac. Copy the Mail folder and the preferences file to the Library and Preferences folder. Make sure that the folder and file are in the correct location!
If you now open Apple Mail on your second Mac, it will look exactly the same as it did on the other Mac. This means your accounts, messages, and folders have all been moved to the second Mac