发送电子邮件涉及哪些协议和服务器,步骤是什么?
在过去的几周里,我一直在努力了解电子邮件的工作原理。 我非常了解客户端使用 POP 从服务器接收邮件的过程。 我还了解客户端计算机如何使用 SMTP 请求 SMTP 服务器发送消息。 但是,我仍然缺少一些东西......
据我了解,外发邮件必须进行三趟:
- 客户端(使用 Thunderbird 的 gmail 用户)到服务器(Gmail)
- 第一服务器(Gmail)到第二服务器(Hotmail)
- 第二服务器(Hotmail)到第二个客户端(使用 OS X Mail 的 hotmail 用户)
据我了解,第一步使用 SMTP 进行客户端通信。 客户端以某种方式对自身进行身份验证(例如,使用 USER 和 PASS),然后向 gmail 服务器发送消息。
但是,我不明白gmail服务器如何将邮件传输到hotmail服务器。
对于第三步,我非常确定,hotmail 服务器使用 POP 将邮件发送到 hotmail 客户端(再次使用身份验证)。
所以,最大的问题是:当我单击“发送邮件”将消息发送到我的 Gmail 服务器时,我的 Gmail 服务器如何将消息转发到 Hotmail 服务器以便我的朋友可以接收它?
谢谢你太厉害了!
〜杰森
谢谢,到目前为止这很有帮助。
据我了解,第一个客户端使用 SMTP 将消息发送到第一个服务器,通常发送到端口 25 上的地址,例如 smtp.mail.SOMESERVER.com(通常)。
然后,SOMESERVER 再次使用 SMTP 将消息发送到端口 25 上的 RECEIVESERVER.com(不是 smtp.mail.RECEIVESERVER.com 或任何奇特的东西)。
然后,当收件人使用 POP 向 RECEIVESERVER 请求其邮件时,他/她会收到邮件...对吗?
再次感谢(特别是詹博士),
杰森
For the past few weeks, I've been trying to learn about just how email works. I understand the process of a client receiving mail from a server using POP pretty well. I also understand how a client computer can use SMTP to ask an SMTP server to send a message. However, I'm still missing something...
The way I understand it, outgoing mail has to make three trips:
- Client (gmail user using Thunderbird) to a server (Gmail)
- First server (Gmail) to second server (Hotmail)
- Second server (Hotmail) to second client (hotmail user using OS X Mail)
As I understand it, step one uses SMTP for the client to communicate. The client authenticates itself somehow (say, with USER and PASS), and then sends a message to the gmail server.
However, I don't understand how gmail server transfers the message to the hotmail server.
For step three, I'm pretty sure, the hotmail server uses POP to send the message to the hotmail client (using authentication, again).
So, the big question is: when I click send Mail sends my message to my gmail server, how does my gmail server forward the message to, say, a hotmail server so my friend can recieve it?
Thank you so much!
~Jason
Thanks, that's been helpful so far.
As I understand it, the first client sends the message to the first server using SMTP, often to an address such as smtp.mail.SOMESERVER.com on port 25 (usually).
Then, SOMESERVER uses SMTP again to send the message to RECEIVESERVER.com on port 25 (not smtp.mail.RECEIVESERVER.com or anything fancy).
Then, when the recipient asks RECEIVESERVER for its mail, using POP, s/he recieves the message... right?
Thanks again (especially to dr-jan),
Jason
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
Gmail 的 SMTP 服务器(接受来自 Thunderbird 的邮件)会将邮件路由到最终收件人。
它通过使用 DNS 查找目标电子邮件地址(本例中为 hotmail.com)的域名部分的 MX(邮件交换器)记录来实现此目的。 DNS 服务器将返回消息应发送到的 IP 地址。 目标 IP 地址处的服务器有望运行 SMTP(在标准端口 25 上),以便它可以接收传入消息。
Hotmail 服务器收到邮件后,就会将其存储起来,直到相应的用户登录并使用 POP(或 IMAP)检索其邮件为止。
杰森 - 回答你的后续问题......
这是正确的 - 发送到的域名被视为收件人电子邮件地址中“@”之后的所有内容。 通常,RECEIVESERVER.com 是更具体的内容的别名,例如传入.RECEIVESERVER.com(或者实际上是 smtp.mail.RECEIVESERVER.com)。
您可以使用 nslookup 查询本地 DNS 服务器(这适用于 Linux 和 Windows cmd 窗口):
这表明向 stackoverflow.com 上的任何人发送的电子邮件都应发送到上面显示的 gmail 服务器之一。
提到的维基百科文章 (http://en.wikipedia.org/wiki/Mx_record) 讨论了优先级编号如上所示(10、20、...、50)。
The SMTP server at Gmail (which accepted the message from Thunderbird) will route the message to the final recipient.
It does this by using DNS to find the MX (mail exchanger) record for the domain name part of the destination email address (hotmail.com in this example). The DNS server will return an IP address which the message should be sent to. The server at the destination IP address will hopefully be running SMTP (on the standard port 25) so it can receive the incoming messages.
Once the message has been received by the hotmail server, it is stored until the appropriate user logs in and retrieves their messages using POP (or IMAP).
Jason - to answer your follow up...
That's correct - the domain name to send to is taken as everything after the '@' in the email address of the recipient. Often, RECEIVESERVER.com is an alias for something more specific, say something like incoming.RECEIVESERVER.com, (or, indeed, smtp.mail.RECEIVESERVER.com).
You can use nslookup to query your local DNS servers (this works in Linux and in a Windows cmd window):
This shows us that email to anyone at stackoverflow.com should be sent to one of the gmail servers shown above.
The Wikipedia article mentioned (http://en.wikipedia.org/wiki/Mx_record) discusses the priority numbers shown above (10, 20, ..., 50).
您可能还想知道为什么 GMail 到 HotMail 链接使用 SMTP,就像您的 Thunderbird 客户端一样。 换句话说,既然您的客户端可以通过 SMTP 发送电子邮件,并且可以使用 DNS 获取 hotmail.com 的 MX 记录,那么为什么不直接将其发送到那里,完全跳过 gmail.com 呢?
有几个原因,一些是历史原因,一些是安全原因。 在最初的问题中,假设您的 Thunderbird 客户端使用用户名和密码登录。 但事实往往并非如此。 SMTP 实际上并不需要登录即可发送邮件。 而且 SMTP 无法判断谁真正发送了邮件。 于是,垃圾邮件就诞生了!
不幸的是,仍然有许多 SMTP 服务器允许任何人和每个人连接和发送邮件,盲目地相信发件人就是他们声称的人。 这些服务器被称为“开放中继”,并且由于它们大量产生垃圾邮件,通常会被其他邮件服务器的聪明管理员列入黑名单。
负责的 SMTP 服务器管理员将其服务器设置为仅在特殊情况下接受邮件传递:1) 邮件来自“其自己的”网络,或 2) 邮件被发送到“其自己的”网络,或 3) 用户提供将他识别为可信发件人的凭据。 情况 #1 可能是当您从工作中发送邮件时发生的情况; 您的计算机位于受信任的网络上,因此您可以向任何人发送邮件。 许多公司邮件服务器仍然不需要身份验证,因此您可以冒充办公室中的任何人。 乐趣! 情况 #2 是有人向您发送邮件。 案例 #3 可能就是您的 GMail 示例中发生的情况。 您不是来自受信任的网络,您只是在互联网上与垃圾邮件发送者在一起。 但通过使用密码,您可以向 GMail 证明您的身份。
历史方面是,在过去,gmail 和 hotmail 之间的链接可能是间歇性的。 通过在本地服务器上排队您的邮件,您可以放心地处理它,因为您知道建立链接后,本地服务器可以将您的邮件传输到远程服务器,远程服务器将保留该邮件,直到收件人的代理接收该邮件。
You might also be interested to know why the GMail to HotMail link uses SMTP, just like your Thunderbird client. In other words, since your client can send email via SMTP, and it can use DNS to get the MX record for hotmail.com, why doesn't it just send it there directly, skipping gmail.com altogether?
There are a couple of reasons, some historical and some for security. In the original question, it was assumed that your Thunderbird client logs in with a user name and password. This is often not the case. SMTP doesn't actually require a login to send a mail. And SMTP has no way to tell who's really sending the mail. Thus, spam was born!
There are, unfortunately, still many SMTP servers out there that allow anyone and everyone to connect and send mail, trusting blindly that the sender is who they claim to be. These servers are called "open relays" and are routinely black-listed by smarter administrators of other mail servers, because of the spam they churn out.
Responsible SMTP server admins set up their server to accept mail for delivery only in special cases 1) the mail is coming from "its own" network, or 2) the mail is being sent to "its own" network, or 3) the user presents credentials that identifies him as a trusted sender. Case #1 is probably what happens when you send mail from work; your machine is on the trusted network, so you can send mail to anyone. A lot of corporate mail servers still don't require authentication, so you can impersonate anyone in your office. Fun! Case #2 is when someone sends you mail. And case #3 is probably what happens with your GMail example. You're not coming from a trusted network, you’re just out on the Internet with the spammers. But by using a password, you can prove to GMail that you are who you say you are.
The historical aspect is that in the old days, the link between gmail and hotmail was likely to be intermittent. By queuing your mail up at a local server, you could wash your hands of it, knowing that when a link was established, the local server could transfer your messages to the remote server, which would hold the message until the recipient's agent picked it up.
您正在寻找邮件传输代理,维基百科有关于该主题的一篇不错的文章。
You're looking for the Mail Transfer Agent, Wikipedia has a nice article on the topic.
步骤 2 到 3(即 Gmail 到 Hotmail)通常通过 SMTP(或 ESMTP - 扩展 SMTP)进行。
Hotmail 不会通过 POP3 向客户端发送任何内容。 了解这里的一些细微差别很重要。 客户端通过 POP3 联系 Hotmail 并请求其邮件。 (即客户发起讨论)。
Step 2 to 3 (i.e. Gmail to Hotmail) would normally happen through SMTP (or ESMTP - extended SMTP).
Hotmail doesn't send anything to a client via POP3. It's important to understand some of the nuances here. The client contacts Hotmail via POP3 and requests its mail. (i.e. the client initiates the discussion).
第一个服务器将在 DNS 中查找 Hotmail 服务器的 MX 记录。 MX是一种特殊记录,定义了某个域的邮件服务器。 知道Hotmail服务器的IP地址后,GMail服务器将使用SMTP协议发送邮件并等待答复。 如果 Hotmail 服务器出现故障,GMail 服务器将尝试重新发送邮件(这将取决于服务器软件配置)。 如果进程正常终止,那么好吧,如果没有,GMail 服务器会通知您他无法传递邮件。
The first server will look at DNS for a MX record of Hotmail server. MX is a special record that defines a mail server for a certain domain. Knowing IP address of Hotmail server, GMail server will sent the message using SMTP protocol and will wait for an answer. If Hotmail server goes down, GMail server wiil try to resend the message (it will depend on server software configuration). If the process terminates ok, then ok, if not, GMail server will notify you that he wasn´t able to deliver the message.
如果您确实想了解电子邮件的工作原理,可以阅读 SMTP RFC 或POP3 RFC。
If you really want to know how email works you could read the SMTP RFC or the POP3 RFC.
所有电子邮件均使用 SMTP(或 ESMTP)传输。
需要了解的重要一点是,当您将邮件发送到 [email protected] 此消息的目的地不是他的 PC。 目的地是 hotmail.com 服务器上某人的收件箱文件夹。
消息到达目的地后。 用户可以在 hotmail 服务器上检查他的帐户上是否有任何新邮件,并使用 POP3 检索它们
。此外,还可以在不使用 gmail 服务器的情况下发送邮件,使用 SMTP 将其直接从您的 PC 发送到 hotmail。
All emails are transferred using SMTP (or ESMTP).
The important thing to understand is that the when you send message to [email protected] this message's destination is not his PC. The destination is someguy's inbox folder at hotmail.com server.
After the message arrives at it's destination. The user can check if he has any new messages on his account at hotmail server and retrieve them using POP3
Also it would be possible to send the message without using gmail server, by sending it directly from your PC to hotmail using SMTP.