When in mail on your old machine you can click on mailbox, then archive mailbox and save the contents to an mbox file. Using a USB stick or other media transfer the mbox file to your new machine. Again in mail click on file, then import mailboxes, apple mail and then point to your file wherever that might be. Done.
The alternative way is to use Time Machine to back up everything including apps, setting, wallpaper, everything and perform a full restore on the new machine. That can be done as part of a new installation of after the event.