This problem is caused by some index corruption (which in turn might be caused by some filesystem corruption) that makes messages to randomly appear in a mailbox different from where they’re supposed to be. If that mailbox happens to be
Outbox, Mail thinks the messages are waiting to be sent and dutifully proceeds to try to send them.
Verify/repair the startup disk (not just permissions), as described here:
The Repair functions of Disk Utility: what's it all about?
After having fixed
all the filesystem issues, if any, and ensuring that there’s enough space available on the startup disk (a few GB, plus the space needed to make a backup copy of the Mail folder), try this:
1. Quit Mail if it’s running.
2. In the Finder, go to
~/Library/Mail/. Make a backup copy of this folder, just in case something goes wrong, e.g. by dragging it to the Desktop while holding the
Option (Alt) key down. This is where all your mail is locally stored.
3. Locate
Envelope Index and move it to the Trash. If you see any other “Envelope Index”-named file there, delete it as well.
4. Open Mail. It will tell you that your mail needs to be “imported”. Click
Continue and Mail will proceed to re-create
Envelope Index — Mail says it’s “importing”, but it just re-creates the index if the mailboxes are already in Mail 2.x format.
Note: For those not familiarized with the ~/ notation, it refers to the user’s home folder. That is, ~/Library is the Library folder within the user’s home folder, i.e. /Users/username/Library.