Having recently purchased a new mac I decided to start with as much of a 'clean slate' as possible, and not use Migration Assistant to copy 100s of GBs of stuff I don't need.

But I did need my email, all of it. And the old way of copying the ~/Library/Mail folder and .plist isn't enough under macOS Sequoia any more.

So, if it helps anynoe else, this is what you need to copy from your old to your new mac (I did it with simple scp commands, but there's many ways to achieve the same!)

~/Library/Mail
~/Library/Preferences/group.com.apple.mail.plist
~/Library/Accounts (this is the new one)

Copy all of these across (and make sure you chown -R <username>:staff ~/Library/Accounts ~/Library/Mail ~/Library/Preferences/group.com.apple.mail.plist afterwards then reboot or log out and in again before opening Mail.

The key thing seems to be the Accounts are now store seperately, so if you copy the Mail folder (even with the plist) it doesn't know they exist.

This worked for me, hope it helps someone else, YMMV.