How to get email from pop.gmail.com using c#?

Posted by jiya gupta on Stack Overflow See other posts from Stack Overflow or by jiya gupta
Published on 2010-06-25T07:10:46Z Indexed on 2010/12/23 19:54 UTC
Read the original article Hit count: 175

Filed under:

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.

© Stack Overflow or respective owner

Related posts about c#