Lost mailboxes after El Capitan upgrade, how can I get them back?

Lost mailboxes after El Capitan upgrade.

My email accounts are working fine after the upgrade but I had a large 'filing system' of mailboxes set up under 'On My Mac' that have not been moved across by the upgrade. I have tried every piece of advice that I can find but it all seems to relate to mailboxes attached to email accounts - inbox, outbox junk etc - but not to the type I have created which are on my Mac rather than on the servers of IMAP providers. Can anyone help please?
Same problem here but 2 out of 40 mailboxes are properly displaying. Where did the other 38 go? I had my mail messages sorted in these mailboxes. Does anyone know how to get the missing ones back?

Original thread: https://forums.imore.com/threads/lost-mailboxes-after-el-capitan-upgrade-how-can-i-get-them-back.345433/