Transfer mail data from one machine to another .
Take back up of all mails in V 5 folder : Method to copy mails in V 5 folder .
Click on Go on top menu bar , hold option key click on > library > select mail folder > right click on mail folder there itself > click on copy mail > right click on extreme right hand side in column B , that is below persistence info.plist > click on paste item .
Entire mails are copied to V 5 folder .
Note : For Mac OS High Sierra the folder will be V 5 , For Mac OS Sierra the folder will be V4 , For El Capitan - the folder will be V 3 , and for OSX Yosemite the folder will be V2
Take a USB stick and copy V 5 folder into it , once it is copied right click on the USB stick and eject it .
Insert the USB stick in the second machine .
Configure new IMAP account in another machine , go to top menu bar , file > import mail boxes > import data from > select apple mail > click on continue > select the back drop folder then choose new .
When new IMAP account is opened , a new folder with all mails will appear in the mail side bar .You can rename the folder .
And if you want to keep a copy of all mails , in the above method mails are copied and pasted , they were dragged into usb stick , you can drag and drop V5 folder to the desktop and save it .
Note : If you directly drag and drop V5 folder from user library ( without copying and pasting ) to the desktop , if you click on finder click on recents ( the recents folder will be flooded with files ) , so don't do this mistake .