I actually ran into the exact same issue recently, so here’s what worked for me:
The problem was that aaPanel only uses one global mail SSL certificate for the whole server. Even though I had multiple SSL mail certs created for different domains, Gmail was still seeing the old/expired one from the main /www/server/panel/plugin/mail_sys/cert/ folder.
What I did was:
Backed up the fullchain.pem and privkey.pem in /www/server/panel/plugin/mail_sys/cert/.
Copied the same files from the subfolder of the domain I actually wanted to use (inside the mail_sys folder).
Restarted the mail service.
After that, Gmail started recognizing the correct SSL certificate and I was able to send mail over port 587 without any errors.
Hopefully this saves someone a few hours of debugging — it’s a simple fix once you know where to look!