ssl - 远程登录到 gmail.com

标签 ssl gmail telnet

如何使用 telnet 登录 smtp.gmail?我很快收到 FConnection closed 消息,然后它返回到终端。

# telnet smtp.gmail.com 465
Trying 173.194.76.108...
Connected to smtp.gmail.com.
Escape character is '^]'.
HELLO
FConnection closed by foreign host.
# telnet smtp.gmail.com 465
Trying 173.194.76.109...
Connected to smtp.gmail.com.
Escape character is '^]'.
HELLO gmail.com
FConnection closed by foreign host.
# telnet smtp.gmail.com 465
Trying 173.194.76.108...
Connected to smtp.gmail.com.
Escape character is '^]'.
HELLO smtp.gmail.com
FConnection closed by foreign host.
#

最佳答案

端口 465 是 smtps。它从一开始就期望 SSL,即此连接中的初始数据应该是 TLS 握手的开始。虽然有一些 telnet 变体也可以使用 SSL,但通常的版本不能。换句话说:您将无法使用普通的 telnet 与 SSL 服务器通信,就像您在使用 smtps 时所面对的那样。不过,您可以使用 openssl s_client,还有其他支持 SSL 的工具。

I quickly get FConnection closed

假设您不是以预期的 TLS ClientHello 开始,而是发送垃圾数​​据(从 TLS 服务器的角度来看),服务器将关闭连接。

HELLO gmail.com

除此之外,这无论如何都不是合适的 SMTP。也许你的意思是 HELO 或 EHLO。但即便如此,您也应该先等待服务器的问候。 HELO 和 EHLO 的参数是您自己的主机名,而不是远程服务器的主机名。

关于ssl - 远程登录到 gmail.com,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52269531/

相关文章:

authentication - Telnet 自动化与 Expect : Slow authentication?

c# - 使用 Google 联系人 API 以编程方式将 "Birthday"添加到 Google 联系人?

linux - 如何从开发箱检查某个端口是否打开或在任何其他服务器上被阻止?

ssl - curl --cacert 错误 "curl: (60) SSL: no alternative certificate subject name matches target host name"

java - 在 Android 中使用 SSL

python - 执行程序时出现错误 "NameError: name ' TLSExtSupportedGroup' is not defined"

java - SSLHandshakeException : ValidatorException: PKIX path building failed: sun. security.provider.certpath.SunCertPathBuilderException:

api - 使用api发送gmail附件失败

c# - 通过 asp.net 向多个用户发送邮件

java - 为什么这段代码只能在带有断点的 Debug模式下工作? (IDE调试器)