无法连接到Gmail的SMTP服务器

我想用我的Gmail帐户和nodemailer发送一些电子邮件。 本地,它工作正常,但不是在我的服务器。

$ telnet smtp.gmail.com 465 Trying 74.125.29.108... Trying 74.125.29.109... Trying 2607:f8b0:400d:c04::6d... telnet: Unable to connect to remote host: Network is unreachable $ openssl s_client -connect smtp.gmail.com:465 connect: Connection timed out $ nslookup smtp.gmail.com Server: 8.8.4.4 Address: 8.8.4.4#53 Non-authoritative answer: smtp.gmail.com canonical name = gmail-smtp-msa.l.google.com. Name: gmail-smtp-msa.l.google.com Address: 74.125.29.108 Name: gmail-smtp-msa.l.google.com Address: 74.125.29.109 

检查你的防火墙规则是否允许连接端口465.如果没有,请尝试telnet到另一个电子邮件服务器,以排除连接到gmail的问题(有很多事情可能会阻止连接)。