'Error [WinError 10054] when sending email TO gmail.com via smtplib from my VPS (other domains are ok)

I'm struggling for few days on this problem : i can't send a mail to a gmail address (other domains such outlook or my own etc. are ok). My domain is hosted on a VPS and no email filter (anti spam) are set.

import smtplib

server = smtplib.SMTP_SSL("MYADRRESSSERVER",465)
server.login("MYLOGIN","SMYPASSWORD")
server.sendmail("MYEMAILADDRESS",
                "[email protected]",
                "Lets go baby!")
server.quit()

ConnectionResetError: [WinError 10054] Une connexion existante a dû être fermée par l’hôte distant

"Une connexion existante ..." means "Distant connection has been closed by distant host"

Any idea on the origin or solution for this? Thanks in advance for your help. Best regards



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source