当我指定 SmtpClient 的端口时,我到底指定了什么?
我可以在 ASP.NET 中使用 SmtpClient 对象指定端口号,我想知道,这只是 .NET 用于向 SMTP 服务器发送邮件的端口吗?或者这会决定 SMTP 服务器使用哪个端口?或者它必须与为 SMTP 服务器配置的端口匹配?
I can specify a port number with SmtpClient object in ASP.NET, what I am wondering is, is that just the port .NET uses to send mail to the SMTP server? Or will that dictate what port for the SMTP server to use? Or is it that it MUST match the port configured for the SMTP server?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您正在指定要连接到您要发送到的 smtp 服务器上的端口号。并非所有 SMTP 服务器都在标准端口上运行,因此您需要能够指定它,并且它必须与 smtp 服务器正在侦听的端口相匹配。
You are specifying the port number to connect to on the smtp server you are sending to. Not all SMTP servers run on standard ports so you need to be able to specify it and yes it must match the port that the smtp server is listening on.
这是 .NET(您的客户端)将 smtp 流量发送到服务器的端口。服务器还必须侦听此端口才能建立连接。
传统上,SMTP 服务器配置为侦听端口 25,但大多数服务器都能够侦听备用端口。这通常是端口 25 的补充,并且在非企业开发场景中特别有用,因为端口 25 被某些 ISP 阻止。
It's the port that .NET (your client) sends smtp traffic to the server on. The server must also be listening on this port in order for a connection to be established.
Traditionally, an SMTP server is configured to listen on port 25, but most servers have the ability to listen on an alternate port. This is usually in addition to port 25 and is particularly useful in a non-corporate development scenario because port 25 is blocked by some ISPs.