I have found a so far temporary solution!!!!!!! This issue was driving me crazy! Every 5 seconds "The Yahoo! IMAP server “imap.mail.yahoo.com” rejected the password" BLAH BLAH BLAH Anyways heres what I did....
1. Go to your Yahoo! account on safari and make sure you are logged out.
2. Delete the Yahoo! account on the mac "mail" open mail (pinned on bottom bar) click mail top left, go to preferences, highlight Yahoo! and click the minus below the accounts.
3. Open safari, click safari in top left, click preferences, security and UNCHECK Enable JavaScript, Close.
4. Sign in to yahoo on safari, it will ask you if you would like to sync yahoo with your mac, say yes, enter password.
5. Voila! Dont forget to reenable Java Script.
I am not sure this is a permanent fix but I have been going strong for a few hours now with no ""The Yahoo! IMAP server “imap.mail.yahoo.com” rejected the password"" Error knock on wood! Good luck!😁