且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

错误C#邮件客户端

更新时间:2022-10-25 09:16:24

请参阅我对该问题的评论。只需在调试器下运行它并检查 POPServ.Text 的值。修复主机名/地址并确保服务器端实际运行。



-SA


您必须添加您的凭据( SmtpClient.Credentials ),并设置 EnableSsl 属性。


I try to create a email client using C# (Windows Form application) this is my code
there is an error occurred when create server part

Server = new TcpClient(POPServ.Text,110); // error comes here "No such host is known"
NetStrm = Server.GetStream();
RdStrm= new StreamReader(Server.GetStream());



POP server - pop.gmail.com
user name pass are correct
pop port - 110
i allso use 995 but same thing happen
what is the reson
Thank in advance

Please see my comment to the question. Just run it under the debugger and check up the value of POPServ.Text. Fix the host name/address and make sure your server side is actually running.

—SA


You have to add your credentials (SmtpClient.Credentials), and set the EnableSsl property.