Library tutorials & articles
How to POP3 in C#
Using the Class
Using the new class is pretty easy.
static void Main(string[] args)
{
try
{
Pop3 obj = new Pop3();
obj.Connect("mail.xxx.com", "yyy", "zzz");
ArrayList list = obj.List();
foreach (Pop3Message msg in list )
{
Pop3Message msg2 = obj.Retrieve(msg);
System.Console.WriteLine("Message {0}:
{1}",
msg2.number, msg2.message);
}
obj.Disconnect();
}
catch (Pop3Exception e )
{
System.Console.WriteLine(e.ToString());
}
catch (System.Exception e)
{
System.Console.WriteLine(e.ToString());
}
}
Instantiate a new object, then call the List method. The List method
will return an array of Pop3Message objects. You can then iterate
through the Pop3Message objects and retrieve each in turn. Finally, you call
the Disconnect method to release the socket. POP3 is described
in RFC 1939. You can read the full specification from the IETF
website.
Related articles
Related podcasts
-
Moving your Email into the Cloud - Google for Apps and Live Custom Domains
Scott and Carl talk about Scott's Family's recent move to Google Apps and Carl considers moving to Live Custom Domains. What are the benefits of moving your life into the cloud?
When i change the port to 587 from 110 i got the following error
220 mx.google.com ESMTP g14sm11215098rvb.54
!--removed tag-->Hi Got the following error when i try to call
obj.Connect("smtp.gmail.com", txtUser.Text, txtPass.Text);
A Connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host failed to respond 209.85.199.111: 110
Can any body please help me to fix this error?
!--removed tag-->Your code is too good. But in your code what happen If i send email today it display that email & tomarrow it show empty inbox. if i again send email it display that new mail only. And i also want to fetch Email subject,Email Body then what i do. Please give solution
!--removed tag-->