how to check if I can connect smtp.gmail.com? [closed]

I have web application which I am setting up on a new vps. It is supposed to send email to the business owner whenever clients leave messages via the web-application.

Apparently, the VPS can not send emails for some reason (I tested it with a python script which working on anther VPS). I am looking for a way to confirm whether a network policy is stopping my vps to connect to smtp.gmail.com:587. Sth like nmap to make sure whether I am allowed to connect to smpt of gmail.

Please let me know your comments.

Answer

You can use telnet to test port connectivity. Example:

[ttucker@localhost ~]$ telnet smtp.gmail.com 587
Trying 2607:f8b0:400e:c02::6c...
Connected to smtp.gmail.com.
Escape character is '^]'.
220 smtp.gmail.com ESMTP x123sm45810007pgb.3 - gsmtp

If you see the 220 smtp.gmail.com ESMTP banner line then you can connect.

Attribution
Source : Link , Question Author : user387451 , Answer Author : Tim

Leave a Comment