The deleted accounts bug
There is a bug in Apple's mail preferences which results in details of deleted accounts being left in your mail database file. Security anyone?!
The following is non destructive (Mail will re-download all of the emails that are still on the server, this does not delete them from the server).
You need to delete or rename ~/Library/Mail/Envelope Index. This is where the old account details are. If you know what you're doing with ssh etc you can do this yourself. If not I have included detailed instructions below
N.B. The step in which you rename the Envelope Index file is just so you have a backup of the locally cached emails, if you don't care just change this step to deleting it, it will have the same effect.
Ok, Easy way! Get Mobile Finder from installer.app and we can do this all from the phone :-)
- Once installed, run mobile finder.
- Click the ~ in the top right corner.
- Double tap Library.
- Scroll to Mail and double tap.
- Tap Envelope Index once.
- Hit the modify button in the middle at the bottom.
- Tap on it's file name and add something on the end ('old' for example).
- Click done at the bottom in the middle (where modify was).
- Hit the home button.
- Click the mail icon (you should see that there are no messages for a second).
It should then re-download everything.
P.S. If the mail app doesn't notice you've removed it's database, hit home and open it again and it should...