Are you running any VPN, Anti-Virus, or Cleaning apps?
Could it be along these lines...
Mac's Mail App is not as modern as iOS's Mail app, Many eMail providers now require a separate App Password different from your eMail password…
Then you may need Ways to securely access AOL Mail…
https://help.aol.com/articles/allow-apps-that-use-less-secure-sign-in
Or it may just need an App Password...
https://support.google.com/mail/answer/185833?hl=en-GB
Yahoo has gone to this too...
https://help.yahoo.com/kb/access-yahoo-mail-third-party-apps-sln15241.html
Yahoo App password…
Generate and manage third-party app passwords
Some older, third-party email apps (that do not use our Yahoo branded sign in page) require you to enter a single password for login credentials. To access your Yahoo Mail account on these apps, you'll need to generate and use an app password. An app password is a long, randomly generated code that gives a non-Yahoo app permission to access your Yahoo account. You’ll only need to provide this code once to sign in to your third-party email app.
https://help.yahoo.com/kb/access-yahoo-mail-third-party-apps-sln15241.html
Using app passwords with apps that don't support two-step verification (microsoft.com)