Mojave Mail drops IMAP connections and can't log in
I am having nonstop problems with Mac Mail after upgrading to Mojave; these problems occur on four different Macs (2 iMacs, 1 MacBook pro 1 Mac air) connecting to Gmail accounts.
What happens is, when Mail opens it connects w/o problem to both the IMAP and SMTP servers for my mail accounts (I have 2). But after about an hour of inactivity, Mail loses the connection and cannot reconnect. All accounts go offline, and Connection Doctor shows repeated reconnects fail with error
READ Apr 13 20:28:43.101 [kCFStreamSocketSecurityLevelTLSv1_2] -- host:imap.gmail.com -- port:993 -- socket:0x600001cba3a0 -- thread:0x6000021a3140
9.100 NO [AUTHENTICATIONFAILED] Invalid credentials (Failure)
The only solution is to quit Mail and reopen - which always solves the problem - for a while - until it happens again.
I have tried all the usual "solutions" (delete and reinstall accounts, check username and passwords for SMTP servers, delete keychain info, etc.) to no avail. It really looks like the problem is between Apple and Google.
iMac 27", macOS 10.14