Here's a troubleshooting document for Gmail SMTP:
https://support.google.com/mail/answer/78775?hl=en
It mentions that one thing you can try is to use port 25 with SSL:
If you tried configuring your SMTP server on port 465 (with SSL) and port 587 (with TLS), but are still having trouble sending mail, try configuring your SMTP to use port 25 (with SSL).