To rebuild a mailbox, proceed as follows. Therefore, it’s wise to try the other methods first if your mailbox is particularly large.
This solution can take quite some time because all messages will be deleted from your Mac.
Mail can completely rebuild your mailbox, which can fix many of the most common problems with missing email.