When I try and delete a message it deletes 4 at a time even though I explicitly state otherwise, since I have like 700 messages, I had to display a maximum of 4.
public void inboxupdate()
{
client.Connect("pop.googlemail.com", 995, true);
if (client.Connected)
{
client.Authenticate(tbxEmail.Text, tbxPassword.Text, OpenPop.Pop3.AuthenticationMethod.UsernameAndPassword);
}
int MessageCount = client.GetMessageCount();
for (int i = 1; i <= 4; i++ )
{
try
{
cbxInbox.Items.Add(client.GetMessage(i).ToMailMessage().Subject, false);
}
catch
{
}
}
}
The code to delete:
private void btnDelete_Click(object sender, EventArgs e)
{
if (cbxInbox.CheckedItems.Count > 1)
{
for (int i = 1; i <= cbxInbox.CheckedItems.Count; i++)
{
client.DeleteMessage(i + 1);
}
}
cbxInbox.Items.Clear();
client.Disconnect();
inboxupdate();
}
Even when I do
client.DeleteMessage(1)
It deletes 4 at a time. Also these messages appear to be old since they don't show up on the first page when I visit mail.google.com Is there a way to distinguish between spam and messages?