The problem is that the ports are being blocked by cloudflare if you use their proxy
Here is the solution I did.
- on cloudflare, set your A record on "mail.domain.com" to DNS ONLY
- go back to aapanel and create a website with your mail address "mail.domain.com"
- go to "ssl" tab and generate cert via lets encrypt then copy the private key and certificates
- got to mail server setting and on your domain click edit ssl then paste the private key and certificates to the text area accordingly
that should take care of the ssl and tls connection that youre having problem with. you should be able to connect your mail to your gmail account.
What we did here is that we generate a letsencrypt ssl certificate to your mail server instead of using cloudflare because cloudflare only allows certain ports.
since we've created a website for mail.domain.com, set a basicAuth to block traffic or do what you think is what you need for security purpose.
PS: got lazy with screenshots so just PM me if things are unclear