简体   繁体   中英

C# : SMTP error

i am creating an email client that sends e-mail address from server ip instead of SMTP , i wrote the following code:

SmtpClient server = new SmtpClient();
server.Host= "50.23.128.66";
server.Port = 25;
server.Send("from@yahoo.com", "to@yahoo.com", "hi", "hope it works");

but when i run it, i get that error:

Unhandled Exception: System.Net.Mail.SmtpException: Service not available, closing transmission channel. The server response was: Cannot connect to SMTP server 50.23.128.66 (50.23.128.66:25), connect error 10061

i actually think that port is wrong . * By the way i am using Windows Server 2008 *

我认为“连接错误10061”与POSIX平台上的errno == ECONNREFUSED相同,这意味着连接未成功,可能是因为您尝试连接的主机未在端口25上运行任何类型的服务器。

According to this SMTP Server Test the server is not open to receiving connections on port 25:

No connection could be made because the target machine actively refused it 50.23.128.66:25

It's possible the server uses some form of encryption, and you will have to connect on one of the "secure" SMTP ports.

Are you sure it's an SMTP server, and not an IMAP server or the like?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM