Follow this guide Self Signed SSL Issue · josephgodwinkimani/cyberpanel Wiki · GitHub
instead of mydomain.com use mail.mydomain.com e.g.
rm -f /etc/letsencrypt/live/mail.mydomain.com/privkey.pem && rm -f /etc/letsencrypt/live/mail.mydomain.com/fullchain.pem
Skip this part Self Signed SSL Issue · josephgodwinkimani/cyberpanel Wiki · GitHub and do Cannot Send Emails As via Gmail - SSL Certificate Mismatch - #4 by josephgodwinke