MTA 到底做什么的?

发布于 2024-10-18 01:58:00 字数 1887 浏览 5 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

愁以何悠 2024-10-25 01:58:00

--- 在不知何故注意到您谈到可能编写 MTA 后进行编辑 ---

要编写 MTA,您需要打开服务器套接字。当有人连接时,您需要按照 SMTP 协议在该套接字上发送和接收文本 (ascii) 数据。 SMTP 非常健谈,因此您可以期待几轮通信。

第一轮通信通常会告诉您是支持 SMTP 还是支持 ESMTP。第二轮(可选)通信是确定安全/加密/功能支持。最终,“客户端”会要求将消息发送到特定地址/地址集。完成后,服务器将指示它已准备好获取电子邮件正文。当邮件正文(及其可选附件)全部传输完毕后,MTA 会告诉您邮件已正常收到。届时,MTA 将充当通过 DNS MX 记录发现的其他 MTA 的客户端,以使您的电子邮件更接近其目标 MTA,后者会将其复制到某人的收件箱中。

因此需要 MTA,因为客户端的邮件投递相当于将实体信件交给邮局。邮局负责邮局间路由(相当于 MTA 到 MTA 的传输)。然后,目的地邮局负责将信件递送到邮政信箱或家庭地址(与计算机收件箱平行)。

他们称其为电子邮件并不是无缘无故的。

---原帖如下---
MTA 将接受邮件消息,查看是否可以转发或投递该邮件,如果可以转发或投递则做出响应,然后如果表明可以转发或投递则转发或投递该邮件。

消息如何接近最终目的地通常与 DNS 有一定关系。 DNS 中的 MX(邮件交换)记录指示负责(或至少更接近负责服务器)特定电子邮件域名的服务器。如果不了解 DNS 的工作原理,就不可能完全了解邮件消息如何接近其目的地。

MTA 通常会查看递送地址,并且将其配置为电子邮件地址的邮件域的“端点”,或者知道服务器 XYZ 距离电子邮件地址的邮件域更近一跳。如果它是端点,它会将消息从线路复制到某人的收件箱中。如果它正在中继,它将把邮件“转发”到下一个 MTA。

--- edit after somehow noticing you talked about possibly writing a MTA ---

To write a MTA, you need to open a server socket. When someone connects, you need to send and receive text (ascii) data on that socket in compliance with the SMTP protocol. SMTP is very chatty, so you can expect a few rounds of communication.

The initial round of communication typically tells you whether SMTP is supported or ESMTP is supported. The second (optional) round of communication is to determine security / encryption / feature support. Eventually the "client" side will ask to send a message to a particular address / set of addresses. When done, the server will indicate that it's ready to get the body of the email message. When the body of the message (and it's optinal attachments) have all been transmitted, the MTA will tell you it received the message fine. At that point in time, the MTA will act as a client to other MTAs discovered via DNS MX records to get your email closer to it's destination MTA which will copy it into someone's inbox.

So an MTA is needed because mail delivery on the client side is the equivalent to handing a physical letter to a post office. Post offices are responsible for inter-postoffice routing (which parallels to MTA-to-MTA transmission). The destination Post office is then responsible for delivery of the letter to the post office box or home address (which parallels one's computer inbox).

They don't call it e-mail for nothing.

--- original post follows ---
A MTA will accept a mail message, see if it can forward or deliver it, respond if it can be forwarded or delivered, and then forward or deliver it if it indicated it could.

How the message gets closer to it's final destination usually has a bit to do with DNS. MX (mail exchange) records in DNS indicate servers which are responsible (or at least closer to the responsible server) for particular email domain names. It is not possible to fully understand how a mail message gets closer to it's destination without understanding how DNS works.

A MTA typically looks at the delivery address, and either is configured to be the "end point" of the email address's mail domain, or knows that server XYZ is one hop closer to the email address's mail domain. If it's an endpoint, it will copy the message from the wire into someone's inbox. If it's relaying it will "forward" the message to the next MTA.

烏雲後面有陽光 2024-10-25 01:58:00

开始吧:http://en.wikipedia.org/wiki/Message_transfer_agent

很快,MTA接收原始消息,决定其最终目的地在哪里,然后将消息转发到该目的地。

可以编写一个非常简单的 MTA,仅传送到本地收件箱。 MTA 是系统中“更容易”编写的部分,因为您可以表现得很糟糕,但仍然可以正常工作,因此与其他系统的互操作性不成问题(这就是当今电子邮件、垃圾邮件和垃圾邮件的大部分复杂性所在)病毒检查)。

MTA 的真正契约很简单,如果您接受系统发送给您的消息,您就承担传递该消息的责任。因此,当该套接字关闭并确认接受时,交付系统的工作就完成了,一切都在您的手中。

如果你的工作做得很糟糕,邮件就会丢失,那就是你的问题了。但玩起来还是很有趣的。

Here ya go: http://en.wikipedia.org/wiki/Message_transfer_agent

Quickly, the MTA receives the raw message, decides where it's ultimate destination is, and then forwards the message on to that destination.

A very simple MTA can be written the delivers only to local inboxes. The MTA is an "easier" part of the system to write because you can behave badly but still be functional, so your interoperability with other systems is less of an issue (that's where much of the complexities of email lie nowadays, that and spam/virus checking).

The real contract of an MTA is simply that if you accept the message from the system sending it to you, you accept responsibility to deliver that message. Thus, when that socket closes with an acknowledgement of acceptance, the delivering systems job is done and it's all in your hands.

If you happen to do a crummy job, mail is lost, and it's your problem. But it's still fun to play around with.

祁梦 2024-10-25 01:58:00

编辑:我链接到的原始教程已出现 404 错误。这是另一个可以的:https://troubleshootguru.wordpress.com/2014/07/06/mail-server-components-mta-mda-mua/

简而言之, MUA 是使用 SMTP 向 MTA 发送电子邮件的用户客户端。 MTA 是负责将 MTA 路由到其目的地的服务器。如果该目的地是另一台服务器,MTA 会将电子邮件交给 MDA。 MDA 是服务器上的客户端,它使用 SMTP 将电子邮件转发到另一台服务器(也是 MTA)。

那么你需要学习什么?如果您想编写 MUA 或 MDA,您需要学习如何打开到另一台计算机的套接字、发送 SMTP 命令以及接收 SMTP 响应。如果您想编写 MTA,则需要了解如何侦听端口上的套接字连接、接收 SMTP 命令以及发送 SMTP 响应。

Edit: The original tutorial I linked to has gone 404. Here's another that's ok: https://troubleshootguru.wordpress.com/2014/07/06/mail-server-components-mta-mda-mua/

In short, a MUA is a user client that uses SMTP to send an email to an MTA. The MTA is a server that is responsible for routing the MTA to its destination. If that destination is another server, the MTA hands the email to an MDA. The MDA is a client on the server that uses SMTP to forward the email to the other server, which is also an MTA.

So what do you need to learn? If you want to write an MUA or MDA, you need to learn how to open a socket to another computer, send SMTP commands, and receive SMTP responses. If you want to write an MTA, you need to learn how to listen for socket connections on a port, receive SMTP commands, and send SMTP responses.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文