How to get email from pop.gmail.com using c#?
- by jiya gupta
hi,
i want to read email from pop.gmail.com using console application.
Pop3 client = new Pop3();
client.Connect("pop.gmail.com",995);
client.Login("[email protected]", "12345");
//client.IsAuthenticated = true;
// get message list
Pop3MessageCollection list = client.GetMessageList();
if (list.Count == 0)
{
Console.WriteLine("There are no messages in the mailbox.");
}
else
{
// download the first message
MailMessage message = client.GetMailMessage(list[0].SequenceNumber);
}
client.Disconnect();
}
i got error server has closed the connection.
i have already disable firewall and antivirus.
plz help me.