Apple Mail refuses to accept correct login
This may be a symptom of problems with the so-called Local Items keychain.

I had some Mail accounts that would not login (though in the server logs I could see a successful login!), and I could not add new Mail accounts (I was getting strange cryptic errors which turned out to be accountsd failing to store the new password in the Local Items keychain).

For some reason (bugs or bad design) it seems to get corrupted or locked.  It is supposedly used to sync passwords for Internet Accounts to multiple devices, but it exists and causes trouble even if you don't use iCloud (I don't).

The solution is relatively easy, but very annoying:  First stop all apps, then entirely remove (or move to the Trash in case you're afraid you might want to have the option to restore it) the sub-directory (or directories) called ~/Library/Keychains/U-U-I-D/ (where U-U-I-D is a long hexadecimal UUID), and then immediately reboot.  I also removed the old mail account password items from the login keychain, but this may not be necessary.  Either way you may have to re-enter passwords for various accounts, but this time they should appear in both your normal login keychain and the magic Local Items keychain.

After rebooting you should see that directory re-created, and in Keychain Access you should see the Local Items keychain unlocked when the login keychain is unlocked -- if not then lock and unlock the login keychain.

Also make sure you have disabled (un-checked) all of the 'automatically manage connection settings' boxes for both incoming and outgoing servers in all Mail accounts (found in Mail Preferences under Accounts/ServerSettings).