Back up all data if you haven’t already done so. Before proceeding, you must be sure you can restore your system to the state it’s in now. If you skip this step, no one but you will be responsible for the consequences.
Select all your mailboxes, and then select Mailbox ▹ Export Mailbox from the Mail menu bar. Export the mailboxes to the Desktop folder.
Make a note of the settings for all your Mail accounts -- everything you'd need to reconstruct the settings from scratch. Quit Mail.
In the Finder, hold down the option key and select Go ▹ Library from the menu bar. Move the following items from the folder that opens to the Trash (some may not exist):
Caches/com.apple.mail
Saved Application State/com.apple.mail.savedState
Leave the Finder window open for now.
Relaunch Mail. If the problem is solved, you’re done. Delete the exported mailboxes. Otherwise, quit Mail and move these items from the open Library folder to the Desktop:
Mail
Preferences/com.apple.mail.plist
Preferences/com.apple.mail.searchhistory.plist
(Note: you are not moving the Mail application. You’re moving a folder named “Mail.”)
Relaunch Mail. It will behave as if you were setting it up for the first time. Go through the setup process with one of your accounts, using the information you noted earlier. Test. Same problem?
If there’s no improvement, quit Mail again and put back the items you moved to the Desktop, replacing any newer ones that may have been created in their place. You don’t need to replace the items you moved to the Trash.
If the issue is resolved, recreate the rest of your Mail settings, then import your mailboxes, delete the items on the Desktop, and close the Finder window.