来自服务器的用户未与smtp.gmail.com通信



我有一个带Bluehost的专用服务器,在那里我可以运行几个脚本和项目(特别是Python(。其中一个是通过smtp.gmail.com的基本电子邮件发送者,端口465,但它随机停止了工作。经过一番挖掘,我意识到我在该服务器中的用户没有成功地与smtp.gmail.com通信。但事实证明,它也没有与smtp.live.com或imap.gmail.com通信,所以我猜那里出了问题。

当我执行命令:openssl s_client-crlf-connect smtp.gmail.com:465 thorough sudo(或直接从root用户(时,在服务器中,这些是输出:

CONNECTED(00000003)
depth=2 C = US, O = Google Trust Services LLC, CN = GTS Root R1
verify return:1
depth=1 C = US, O = Google Trust Services LLC, CN = GTS CA 1C3
verify return:1
depth=0 CN = imap.gmail.com
verify return:1
---
Certificate chain
0 s:CN = imap.gmail.com
i:C = US, O = Google Trust Services LLC, CN = GTS CA 1C3
1 s:C = US, O = Google Trust Services LLC, CN = GTS CA 1C3
i:C = US, O = Google Trust Services LLC, CN = GTS Root R1
2 s:C = US, O = Google Trust Services LLC, CN = GTS Root R1
i:C = BE, O = GlobalSign nv-sa, OU = Root CA, CN = GlobalSign Root CA
---
Server certificate
-----BEGIN CERTIFICATE-----
blablablabla
.
.
.
blablablabla
-----END CERTIFICATE-----
subject=CN = imap.gmail.com
.
.
.
etc

来自我的用户:

CONNECTED(00000003)
depth=3 C = GB, ST = Greater Manchester, L = Salford, O = Comodo CA Limited, CN = AAA Certifi        cate Services
verify return:1
depth=2 C = GB, ST = Greater Manchester, L = Salford, O = COMODO CA Limited, CN = COMODO RSA         Certification Authority
verify return:1
depth=1 C = US, ST = TX, L = Houston, O = "cPanel, Inc.", CN = "cPanel, Inc. Certification Au        thority"
verify return:1
depth=0 CN = [My server name!!!!! WHY?????]
verify return:1
---
Certificate chain
0 s:/CN=[my server name]
i:/C=US/ST=TX/L=Houston/O=cPanel, Inc./CN=cPanel, Inc. Certification Authority
1 s:/C=US/ST=TX/L=Houston/O=cPanel, Inc./CN=cPanel, Inc. Certification Authority
i:/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Certification Au        thority
2 s:/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Certification Au        thority
i:/C=GB/ST=Greater Manchester/L=Salford/O=Comodo CA Limited/CN=AAA Certificate Services
---
Server certificate
-----BEGIN CERTIFICATE-----
blablablabla
.
.
.
blablablabla
-----END CERTIFICATE-----
subject=CN = [My server again] 
.
.
.
etc

imap.gmail.com、smtp.live.com和我想也会发生同样的事情。我的服务器似乎在与自己通信,而不是与外部服务器通信。通过端口443对网站的其他openSSL查询运行良好,重要的是,当我使用Telnet smtp.gmail.com 25时,它也可以连接到我自己的服务器,而不是sudo/root用户,在那里它运行良好。

我能用SSL或类似的东西坏掉吗?

谢谢!

对于共享主机,对外部系统的访问仅限于端口80和443。引用Bluehost Web主机帮助-脚本无法进行出站连接:

我们的共享IP地址只允许在端口80(http(、443(https(上进行出站连接。。。为了阻止来自我们服务器的垃圾邮件,我们不允许使用或不使用专用IP到端口25和465的出站连接

最好的解决方案是联系Bluehost,在扩展到他们的高级团队后,他们得到了解决方案:

Hello,
Thank you for your response, explaining the issue you are experiencing further.
There is a setting in the WHM that only allows outbound SMTP connections from root, exim and mailman.  I set that to off so you will now be able to connect via SMTP as the cPanel user and not just as root.

最新更新