Click here to Skip to main content
15,901,961 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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

C#
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
Posted
Comments
Richard C Bishop 14-Mar-13 14:34pm    
I think that describes it, the host you are using does not exist.
[no name] 14-Mar-13 14:35pm    
The probable reason is that you are trying to use a TcpClient to connect to a mail server.
Manoj Chamikara 14-Mar-13 14:42pm    
ThePhantomUpvoter Thank You
How Should i correct it
[no name] 14-Mar-13 14:48pm    
You would use an SmtpClient. For an example see http://stackoverflow.com/a/32336/1861918
Manoj Chamikara 14-Mar-13 15:01pm    
Thank You Now i understand what's happen

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
 
Share this answer
 
You have to add your credentials (SmtpClient.Credentials), and set the EnableSsl property.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900