This is a very quick post, but I think it can be useful for anyone with the same problem.
After properly backing up my Mac using Time Machine I went through with El Capitan / OS X 10.11 upgrade. After a little less than 30 minutes the laptop was up and running again but to my surprise, as soon as I launched Mail.App it started doing some database file migration.
A couple of minutes went by and when Mail.App finally loaded all the emails on my Inbox had simply disappeared. Since I didn’t feel like going through the backup restore process I quickly found that using the Rebuild option for the Mailboxes would do the trick. So if you are stuck like I was just do the following:
1. Launch Mail.App
2. Mailbox > Take All Accounts Offline
3. Select the folder where the messages are missing and click Mailbox > Rebuild
That should do the trick and save a little time from messing with messages restore from Time Machine.