After hours of trying the problem to fix, I found out that only A record mail.domain.com is able to configure emails.
IMAP POP and SMTP A record are not working. and you can only use SSL protocol to configure emails.
TLS protocol not working with both lets encrypt and cloudflare origin certificate.
SSL protocol successfully working with both lets encrypt and cloudflare origin certificate.
This is a weird problem I came across to find a workaround to configure emaills. Need AAPanel members to look.