I am trying to do a mail app with Windows Forms C#. I only want to see the top 20 rows of my inbox.
Edit: The code is working fine but only listing me 20 random emails in my inbox
I've tried this:
using (var client = new Pop3Client())
{
client.Connect("pop.gmail.com", 995, true);
client.Authenticate("mail", "passwrd");
for (int i = client.Count - 20; i < client.Count; i++)
{
var message = client.GetMessage(i);
Console.WriteLine("Subject: {0}", message.Subject);
txtBoxMails.AppendText("Subject: " + message.Subject + "\n");
}
client.Disconnect(true);
}
you should use
GetMessageCountinstead ofCount