Apple Mail refuses to accept correct login After a hard disk crash and restore from Carbon Copy Cloner, Apple Mail refuses to accept known correct passwords. Connection Doctor logs say "Authentication aborted by client". 

I have removed the Keychain. I have, successfully, logged in as a different user and made the account there. 

Two other symptoms which may or may not be connected;
1. Internet Accounts will not delete or modify accounts
2. I can't log out of iCloud. 

The accounts in Mail are a mixture. The two I'm focussing on are a Gmail account and a POP account. I have tried adding the accounts again. 

I would even accept destroying all the accounts and importing them all again but I am unable to even do this.
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).