Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using the below code to connect with GMAIL using POP3 protocol but everytime I am getting an error which is read as : "An existing connection was forcibly closed by the remote host."

NOTE : I am using EAGetMail assembly

I have tried this with IndependentSoft and I was able to connect, but it always throw exception to me using EAGetMail.

Please help ........


C#
MailServer oServer = new MailServer("pop.gmail.com", "username@gmail.com", "pwd1234", ServerProtocol.Pop3);
MailClient oClient = new MailClient("TryIt");
oServer.SSLConnection = true;
oServer.Port = 995;
try
{
    oClient.Connect(oServer);
    MailInfo[] infos = oClient.GetMailInfos();
    Console.WriteLine(infos.Length);
    for (int i = 0; i < infos.Length; i++)
    {
        MailInfo info = infos[i];
        Mail oMail = oClient.GetMail(info);
         
        Console.WriteLine("From: {0}", oMail.From.ToString());
        //oClient.Delete(info);
    }
    oClient.Quit();
}
catch (Exception ep)
{
    Console.WriteLine(ep.Message);
}
Posted
Updated 10-Mar-14 3:56am
v2
Comments
Maarten Kools 10-Mar-14 9:55am    
Just to be sure, are you sure POP3 is enabled in your GMail settings?

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