You need to isolate:
1.
- disable all internet email accounts in system preferences.
- Try opening mail now. If it opens without crashing, one of the accounts are the cause. Turn each one on, one by one while opening mail between each one to find out which is the culprit. When you find the culprit it would be best to remove and re-add the affected account (in system prefs).
- if issues persists when you disable all accounts move onto step 2.
2.
- create a new user account
- does the mail app open on a new user, if yes then you know your issue is affecting the user library of your user account. Move onto step 3.
- if issues persists in a new user move onto step 4.
3.
- If you are positive all accounts are IMAP and emails are stored on the server (not locally to your device)
- Remove all email internet accounts from system preferences
- delete all contents from the ~/Library/Mail (contents, not the mail folder itself) to the trash and then restart your mac
- test to see if the issue is resolved after the restart, does mail open? If yes you can re-add your accounts
4.
- If issue is happening in both your user and a new user account
- Isolate to see if third-party plugins or extension kernels are causing the issue, Boot to safemode and test the issue.
- If issues persist whilst in safemode i would reinstall the OS.
Funsize,
I've narrowed it down to step 4 safe mode mail opens fine. I can't figure out what third-party plugin or extension maybe crashing Mail. I have looked over my anti-virus program Bitdefender and excluded mail from being scanned.
The console is giving me some errors when Mail crashes but I really can't make heads or tails on this and google search is come up dry. Thoughts
error 08:55:02.323001 -0700 Mail SQLite error 10 (extended: 6922) - disk I/O error: setting server-reported highest mod sequence for IMAP mailbox
error 08:55:02.323198 -0700 Mail SQLite error 1 (extended: 1) - SQL logic error or missing database: rolling back transaction
error 08:55:04.324723 -0700 Mail SQLite error 10 (extended: 6922) - disk I/O error: setting server-reported highest mod sequence for IMAP mailbox
error 08:55:04.324947 -0700 Mail SQLite error 1 (extended: 1) - SQL logic error or missing database: rolling back transaction
error 08:55:05.326710 -0700 Mail SQLite error 10 (extended: 6922) - disk I/O error: gathering message counts
error 08:55:05.326883 -0700 Mail SQLite error 1 (extended: 1) - SQL logic error or missing database: rolling back transaction
error 08:55:07.327572 -0700 Mail SQLite error 10 (extended: 6922) - disk I/O error: setting server-reported highest mod sequence for IMAP mailbox
error 08:55:07.327784 -0700 Mail SQLite error 1 (extended: 1) - SQL logic error or missing database: rolling back transaction
error 08:55:09.329293 -0700 Mail SQLite error 10 (extended: 6922) - disk I/O error: setting server-reported highest mod sequence for IMAP mailbox
error 08:55:09.329486 -0700 Mail [+[MFLibrary executeBlock:isWriter:useTransaction:isPrivileged:]] SQLite error 10: setting server-reported highest mod sequence for IMAP mailbox
default 08:55:49.803315 -0700 Mail multiple links to file: /Users/..../Library/Mail/V5/MailData/Envelope Index
error 08:55:49.804439 -0700 Mail BUG IN CLIENT OF libsqlite3.dylib: database integrity compromised by API violation: vnode unlinked while in use: <unresolvable path>
error 08:55:49.804444 -0700 Mail BUG IN CLIENT OF libsqlite3.dylib: database integrity compromised by API violation: vnode unlinked while in use: <unresolvable path>
error 08:55:49.804488 -0700 Mail BUG IN CLIENT OF libsqlite3.dylib: database integrity compromised by API violation: vnode unlinked while in use: <unresolvable path>
error 08:55:49.804501 -0700 Mail invalidated open fd: 31 (0x11)
error 08:55:49.804510 -0700 Mail invalidated open fd: 22 (0x11)
error 08:55:49.804546 -0700 Mail BUG IN CLIENT OF libsqlite3.dylib: database integrity compromised by API violation: vnode unlinked while in use: <unresolvable path>
error 08:55:49.804552 -0700 Mail invalidated open fd: 17 (0x11)
default 08:55:49.804566 -0700 Mail No temporary database file -journal found, skipping
error 08:55:49.804571 -0700 Mail BUG IN CLIENT OF libsqlite3.dylib: database integrity compromised by API violation: vnode unlinked while in use: <unresolvable path>
error 08:55:49.804627 -0700 Mail invalidated open fd: 11 (0x11)
error 08:55:49.804668 -0700 Mail invalidated open fd: 3 (0x11)
default 08:55:49.804757 -0700 Mail Removed temporary database file -wal
error 08:55:49.804775 -0700 Mail BUG IN CLIENT OF libsqlite3.dylib: database integrity compromised by API violation: vnode unlinked while in use: <unresolvable path>
error 08:55:49.804776 -0700 Mail BUG IN CLIENT OF libsqlite3.dylib: database integrity compromised by API violation: vnode unlinked while in use: <unresolvable path>
error 08:55:49.804805 -0700 Mail BUG IN CLIENT OF libsqlite3.dylib: database integrity compromised by API violation: vnode unlinked while in use: <unresolvable path>
error 08:55:49.804804 -0700 Mail BUG IN CLIENT OF libsqlite3.dylib: database integrity compromised by API violation: vnode unlinked while in use: <unresolvable path>
error 08:55:49.804828 -0700 Mail BUG IN CLIENT OF libsqlite3.dylib: database integrity compromised by API violation: vnode unlinked while in use: <unresolvable path>
error 08:55:49.804981 -0700 Mail invalidated open fd: 32 (0x11)
error 08:55:49.805034 -0700 Mail invalidated open fd: 23 (0x11)
default 08:55:49.805042 -0700 Mail Removed temporary database file -shm
error 08:55:49.805062 -0700 Mail BUG IN CLIENT OF libsqlite3.dylib: database integrity compromised by API violation: vnode unlinked while in use: <unresolvable path>
error 08:55:49.805093 -0700 Mail invalidated open fd: 9 (0x11)
error 08:55:49.805146 -0700 Mail invalidated open fd: 18 (0x11)
error 08:55:49.805198 -0700 Mail invalidated open fd: 12 (0x11)
error 08:55:49.805407 -0700 Mail invalidated open fd: 10 (0x11)
default 08:55:49.812022 -0700 useractivityd -- Demoting self.advertisingProcess to nil (was UserActivityClient(pid=1161/com.apple.mail uuids={}))
default 08:55:49.835499 -0700 UserEventAgent Unregistered XPC Activity: com.apple.mail.ApplicationRefresh
default 08:55:50.118811 -0700 dasd CANCELED: 501:com.apple.mail.ApplicationRefresh:106A8E <private>!