Connection Error - Unable to connect to the server / port you provided. (IMAP)

Getting “Connection Error - Unable to connect to the server / port you provided. (IMAP)”. while connecting gmail account.
The IMAP, SMTP and POP services are enabled on gmail.
OS: Ubuntu 22.04
MailSpring Version: 1.10.3

Same issue with O365 acc on Ubuntu 22.04

Adding a Gmail account on Arch Linux also appears, Connection Error - Unable to connect to the server / port you provided. (IMAP)

I am sick of this crappy email client . Had enough accounts dont connect for days , sent messages disapear , keep being told unable to send due to connection issues . I am done with this awful email client !

Even the community posting box is clunky and awful to use …

Thanks