My issues aren't as severe but I've just had a phase of emails opening blank and refusing to display contents. I did a similar thing and rebuilt the index and this seems to have fixed it up for me.
I used this command line instruction to do the rebuild. Close mail and run the command then reopen mail again.
sqlite3 ~/Library/Mail/V3/MailData/Envelope\ Index vacuum\ subjects;
I found this command on line ages ago so thanks to whoever wrote and published it. I updated it to V3 for Yosemite / El Cap.
Thanks that script that you gave me seems to have helped. But the real culprit is that when mail was upgraded it hosed a bunch of the outgoing mail server settings. Once I fixed that it all seems to work now.