Please back up all data.
If you use iCloud Drive, please open the iCloud pane in System Preferences. There is a checkbox marked iCloud Drive, and next to that, a button marked Options. Click that buttion, and in the sheet that drops down, uncheck the box marked Mail if it's checked.
Step 1
If Mail crashes or freezes immediately on launch, try the steps suggested on this page. Sometimes a corrupt message on a mail server can be deleted by logging in to the server through its web page. If Mail still won't launch, or if you can't take Step 2 for any other reason, skip to Step 3.
Step 2
There are three types of mail account: IMAP, Exchange, and POP. You can determine the type of each account by opening the Mail preferences window, selecting the Accounts tab, and then selecting Account Information.
Export all POP mailboxes to the Desktop folder.
If you have IMAP or Exchange accounts, and you don't store sent, deleted, and junk messages on the server, export those mailboxes the same way. You can determine whether the messages are on the server by selecting Mailbox Behaviors in the Accounts tab.
Also export all mailboxes in the On My Mac category.
You don't have to export the other mailboxes, because the messages are stored on the servers.
Quit Mail.
Step 3
In System Preferences, open Internet Accounts (OS X 10.9 or later) or Mail, Contacts & Calendars (OS X 10.7 or 10.8). Make notes of the settings for each mail account (all types), then delete the accounts.
Step 4
In the Finder, hold down the option key and select
Go ▹ Library
from the menu bar. Move the following items (some may not exist) from the folder that opens to the Desktop:
Application Support/AddressBook/MailRecents-v4.abcdmr
Containers/com.apple.corerecents.recentsd
Containers/com.apple.mail
Containers/com.apple.MailServiceAgent
Containers/com.apple.share.Mail.compose
Mail
Note: you are not moving the Mail application. You’re moving a folder named “Mail.”
Step 5
Launch Mail. It will behave as if you were setting it up for the first time. Go through the setup process with one account, using the information from Step 3. Test. If Mail works now, recreate the rest of the accounts (if you have more than one) and other settings.
Any custom stationery that you created may be lost. Ask for instructions if you want to preserve that data.
If there’s no improvement, quit Mail and put back the items you moved to the Desktop, replacing any newer ones that may have been created in their place. Stop here and post your results.
Step 6
If you took Step 2, import the mailboxes you exported (see the support article linked to Step 2 for instructions.) Typically, the process takes a few minutes, but it may take hours if you have gigantic mailboxes. In that case, you may be able to speed things up by temporarily adding your home folder to the Privacy list in the Spotlight preference pane. Remove it when Mail has finished importing.
The mailboxes that you didn't export should synchronize automatically with the server. Again, if the mailboxes are very large, downloading them may take quite some time, and network performance will be slower than usual during that time.
If you skipped Step 2, look inside the Mail folder on the Desktop for a subfolder
V3/Mailboxes (for OS X 10.11 or later)
or
V2/Mailboxes (for any older version of OS X)
Import the mailboxes it contains.
Test. If Mail is still working, delete the items you moved to the Desktop in Step 4.
Re-enable the Mail option in the settings for iCloud Drive, if you disabled it, and test again. If you weren't already using iCloud Drive with Mail, there is no need to enable it now, unless you want to.