使用 C# 了解 MX 记录

发布于 2024-10-05 06:00:37 字数 229 浏览 1 评论 0原文

我可能缺少对邮件传输如何工作以实现它的理解。

我想实现一个 SMTP 服务器,它从客户端接收电子邮件,然后查找域的收件人 MX 记录,以便将其传递到那里。

我不完全明白接下来会发生什么,它是否通过 IP 连接到该域?到哪个港口?

我正在查看的示例是 Gmail,它的 MX 服务器是 gmail-smtp-in.l.google.com,我的程序需要通过什么端口连接到该域?

谢谢

I am probably missing a piece of understanding about how mail transfer works in order to implement it.

I want to implement an SMTP server, it receives an email message from the client, then it looks for the recipient MX record of the domain in order to deliver it there.

What I don't fully understand is what happens next, does it connect to that domain by IP? to which port?

The example I am looking at is Gmail, it MX server is gmail-smtp-in.l.google.com, does my program need to connect to this domain on what port?

Thank you

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

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

发布评论

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

评论(2

满地尘埃落定 2024-10-12 06:00:37

阅读:http://www.ietf.org/rfc/rfc5321.txt

简短回答:

发送电子邮件时。查找相关域名的 mx 记录。

如果该域存在 MX,请尝试通过端口 25 连接到它们,并根据上述 RFC 向您发送邮件。您可以按照列出的优先顺序连接到它们。数字越小,偏好越高。如果存在等价 MX,您可以随意选择一个。如果那个人没有回答,请在进入链条的更高位置之前尝试相同的重量 MX。如果没有 MX 答复,则将邮件排队并重试。

如果不存在 MX,请尝试传递到众所周知的端口 25 (SMTP) 上的“A”记录。

但实际上,阅读 RFC 并熟悉它们,这会很有帮助......

并且有些相关。如果您要实现在 Internet 上使用的 SMTP 服务器,请确保您能够在提交端口 (587) 以及标准端口 25 上接受 SMTP 身份验证的电子邮件。由于许多网络在端口上都有出站阻止25 用于减少垃圾邮件目的。

Read: http://www.ietf.org/rfc/rfc5321.txt

Short Answer:

When delivering email. Look for mx records of the domain name in question.

If MXs exist for for the domain attempt to connect to them via port 25 and deliver you mail per RFC Above. You connect to them in order of preference listed. Lower Numbers have higher preference. If equi-cost MX's are present, you are free to pick one at random. If that one doesn't answer try the same Weight MX before going higher in the chain. If no mxs answer then queue mail and try again..

If no MXs exist try to deliver to the 'A' Record on the well know port of 25 (SMTP).

But really, read the RFCs and become familiar with them, it will help out a lot..

And somewhat related. If you are implementing a SMTP server for use on the internet, Make sure that you have the ability to accept SMTP authenticated email on the Submission port (587) as well as the standard port of 25. As lots of networks have outbound blocks on port 25 for spam abatement purposes..

别理我 2024-10-12 06:00:37

SMTP 在端口 25 上运行。这篇 CodeProject 文章展示了一个使用 C# 的简单本地示例发送/接收邮件。

SMTP operates on port 25. This CodeProject article shows a simplistic local example using C# to send/receive mail.

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