I have found a couple of solutions that worked for one of my accounts but not the other. Note that my accounts are POP.
Solution #1: Edit Accounts.plist directly
1. Quit Mail
2. Make a backup of the ~/Library/Mail/V2/MailData/Accounts.plist file.
3. Edit the ~/Library/Mail/V2/MailData/Accounts.plist file manually in a text editor.
4. Find the offending setting(s) that differ from the correct setting(s) and correct them (note - this is an XML file so you have to understand markup languages - but it is pretty straightforward)
5. Start Mail and see if it works!
Solution #2: Delete all your accounts, restart Mail, and start over:
1. When you setup the account, enter your name and email address.
2. When you hit Continue it will try to contact your server, and in my case, will fail or will complain about a certificate issue - if so - hit "Cancel".
3. You will then get another config window where you can enter you POP account info.
4. When you hit Continue - it will try to login to your POP server - regardless of what it says, hit Continue and enter your correct authentication options and Continue.
5. On the next screen, enter your SMTP server info and hit Continue. Hopefully it will complain about something and present you with an option to Setup Manually - anytime you get this option, select Setup Manually.
6. Enter your outgoing server authentication setting.
7. It will now show you all of the settings you have entered, with a checkbox re: whether you want to activate the account - make sure that is NOT checked.
8. Continue and then Mail will start and show you your new account
9. Edit the settings of the new account you just created and make sure the settings are correct (e.g. the setup above never lets you specify whether to use default ports or not - go there and make sure setting is correct).
10. Bring the account online and both the POP and SMTP should work. The key here seems to be the option that says "Setup Manually" - but I can't figure out how to force that option in all cases.
Mountain Lion Mail definitely has a bad bug. I've tried changing various settings and then examining the contents of Accounts.plist (in ~/Library/Mail/V2/MailData) and the results are discouraging - there doesn't seem to always be a co-relation between what you put in the config GUI and what shows up in Accounts.plist. The fact that using the "Setup Manually" option (when you can get it) seems to result in an SMTP account that works, while the normal method doesn't, shows there is a bad bug somewhere. I think someone at Microsoft has infiltrated Apple.