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开发者_JAVA技巧 port for the SMTP server to use? Or is it that it MUST match the port configured for the SMTP server?
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.
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.
精彩评论