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