Mail on my Mac Pro running the latest update of High Sierra (newest OS I can use) keeps crashing when I use "Select All" to empty the trash Application Specific Information:
* Terminating app due to uncaught exception 'NSRangeException', reason: '* -[__NSArrayM objectAtIndexedSubscript:]: index 9223372036854775807 beyond bounds [0 .. 1]'
terminating with uncaught exception of type NSException
abort() called

Mail does not crash when I delete each email in the trash individually, only when I select them all then hit "delete." I have tried to delete the mail preferences, rebuilt the mailbox, deleted/reinstalled the account, reset the VRAM, erased the disk and reinstalled High Sierra (then restored from CCC5), ran disk utility from Recovery Drive, called AppleCare (very dismissive of my "obsolete" Mac Pro), booted into Safe Mode (same problem).
When you rebuilt the mailbox did you also get it to re-index? 

Quit mail, then ~/Library/Mail/V6/MailData/ delete all the Envelope Index files [duplicate to the desktop first for safety] &amp; re-launch Mail. 

The rebuild may take some time