Do a backup, preferably 2 on 2 separate drives.
Go to Finder and select your user/home folder. With that Finder window as the front window, either select Finder/View/Show View options or go command - J. When the View options opens, check ’Show Library Folder’. That should make your user library folder visible in your user/home folder. Go to Library/Containers/com.apple.mail. Move the folder com.apple.mail to your desktop. You must move the entire folder, not just the contents.
Restart, re-launch Mail and test. If the problem is solved, recreate any required Mail settings and import any emails you want to save from the folder on the desktop. You can then put the folder in the Trash. If the problem remains, return the folder to where you got it replacing the one that is there.
If that doesn’t solve it repeat the above using Containers/com.apple.MailServiceAgent.