Hello and welcome.
-Which model Mac?
-Which version of macOS?
-Did the issue start randomly or after a macOS update/upgrade?
-Have you tried quitting the Mail application completely, going to > System Preferences... > Internet Accounts, and re-entering the passwords for the accounts there, then restarting?
C