问题描述
所以我正在学习SMTP,并尝试使用 telnet
通过SMTP发送一些邮件。
So I'm learning about SMTP and am trying to use telnet
to send some mail over SMTP.
我已经很容易地通过以下方式将邮件发送到我的Gmail帐户:
I've easilly been able to send mail to my gmail account via:
$ host gmail.com
...
gmail.com mail is handled by 5 gmail-smtp-in.l.google.com.
...
$ telnet gmail-smtp-in.l.google.com 25
Trying 74.125.142.27...
...
Connected to gmail-smtp-in.l.google.com.
...
HELO <[email protected]>
...
但是,我无法从我的Gmail帐号。根据我对SMTP的了解,我应该使用SMTP从< [email protected]>
到出站gmail SMTP服务器,反过来又使用SMTP将邮件传送到接收方的传入SMTP服务器等等。
However, I'm having trouble sending from my gmail account. From what I understand about SMTP, I should be using SMTP to send mail from < [email protected] > to the outgoing gmail SMTP servers, which in turn use SMTP to transfer the mail to the receivers incoming SMTP server ect.
然而,我遇到困难。如果我 telnet
到 smtp.gmail.com
通过端口 465
(GMAIL传出SMTP邮件服务器的规范),我立即与起动后断开 HELO< [email protected]>
,或要求 STARTTLS
。我找不到如何进行的答案。
However, I'm having difficulties. If I telnet
into smtp.gmail.com
via port 465
(gmail outgoing smtp mail server canonical), I'm immediately disconnected after starting with HELO <[email protected]>
, or asked to STARTTLS
. I can't find answers on how to proceed.
任何帮助都不胜感激。
Any help is appreciated.
Sidenote:目前我正在使用星巴克免费Wi-Fi访问互联网。我实际上不能直接从我的电脑(没有路由到主机的错误) telnet
。相反,它只是,那么远程登录
从那里工作,如果我 SSH
进入我校的网络上的远程Linux操作系统中第一。任何想法为什么会这样?
Sidenote: Currently I'm using Starbucks free Wi-Fi to access the internet. I'm actually unable to telnet
directly from my computer (No route to host error). Instead, it only works if I ssh
into a remote linux box on my school's network first, then telnet
from there. Any idea why this is?
谢谢!
推荐答案
首先,它看起来像你'使用错误的端口。 Gmail通过SSL公开SMTP端口465,使用STARTTLS显示SMTP端口587,。这两者之间的区别是,SMTP over SSL首先建立安全的SSL / TLS连接,并通过该连接进行SMTP,而STARTTLS的SMTP以未加密的SMTP启动,然后切换到SSL / TLS。这就是为什么你没有得到你的HELO的回应。
First of all, it looks like you're using the wrong port. Gmail exposes port 465 for SMTP over SSL and port 587 for SMTP with STARTTLS, as documented here. The difference between these two is that SMTP over SSL first establishes a secure SSL/TLS connection and conducts SMTP over that connection, and SMTP with STARTTLS starts with unencrypted SMTP and then switches to SSL/TLS. This is why you don't get a response to your HELO.
$ telnet smtp.gmail.com 587
Trying 74.125.25.108...
Connected to gmail-smtp-msa.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP fr1sm24834956pbb.26 - gsmtp
HELO <[email protected]>
250 mx.google.com at your service
STARTTLS
220 2.0.0 Ready to start TLS
但即使您远程登录587端口,您仍然无法手动发送任何电子邮件。为了做任何有趣的事情,您必须,您将无法处理协商加密。
But even if you telnet to port 587 you still aren't going to be able to send any email by hand. In order to do anything interesting you will have to STARTTLS, and you won't be able to handle the SSL/TLS binary protocol to negotiate the encryption.
这篇关于使用SMTP,Gmail和STARTTLS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!