I suffered through this frustration back in 2009! So it's not a Lion/Snow Leopard/Tiger issue. But when it happened to be again this January, none of the things I did back i 2009 helped. But the problem was, eventually solved.
The solution envloves deleting your current DotMac/MobileMe/Apple/etc mail account. So copy down and verify all your current information before trying the solution that worked for me. 😮 Better safe than "Oops!"
After recording all your needed info, simply delete the current Apple Mail account in the Account tab of the prefs.
What you will now do is to create the Apple mail account manually, instead of using the built-in shortcuts. I'll have to do this from memory since Mail won't allow a complete re-creation of an exisiting account. This solution was provided by an Apple Tech by phone after I gave up on the "Chat" and 'email' methods. One-toone conversations is much easier by phone and one can verify that responses are understood better than assuming the other party actually read a previous post.
1. Open Mail if it's not yet running.
2. Open the Mail prefs and select the Accounts tab.
3. Click the "+" button or use the "Add account..." menu item in the File menu.
4. If you have an option to set up an account manually, use that. If that option is not readily available, simply enter some bogus info and you should get a dialog providing the "Manual" option. The way to access this may be different in pre-Lion versions, so I can't be more specific.
The key to the problem is to get a screen labeled similarly to "Incoming Mail Server." On that screen will be several choices of "Account Type:" Mail may suggest "MobileMe" or "iCloud" (at least if you have Lion). It is imperative that you DO NOT select those 'helpful' choices. 😉 We want Mail to behave like a basic, generic email application.
5. Once you see the "Incoming Mail Server" screen, select "IMAP". Then, fill in the remaining fields (you did write all that info down, right?!).
Unless I'm forgetting something, the rest is straight forward. The result is that Mail will be forced to save all the info, including your password and operate normally. A new entry will be created in Keychain. You can delete the old entries if you so choose, however, there is no real need for that.
Please post again if this didn't work for you and I'll attempt to re-create an account differently and/or verify the method of getting the manual screen to appear.