Unable to delete e-mails from Gmail using POP3

0 votes
asked Apr 4, 2011 by Rebex KB (8,240 points)
edited Apr 4, 2011

I've deleted all messages from my Gmail mailbox using the following code:

Pop3 client = new Pop3(); 
client.Connect("pop.gmail.com", Pop3.DefaultImplicitSslPort, null, Pop3Security.Implicit);
client.Login("username", "password");
Pop3MessageCollection messages = client.GetMessageList(Pop3ListFields.FullHeaders);
Console.WriteLine("Processsing {0} messages...", messages.Count);
foreach (Pop3MessageInfo msg in messages)
    client.Delete(msg.SequenceNumber);
client.Disconnect();

The first execution successfully processes all messages, any next execution finds no message in my POP3 mailbox.

However, when I connect to the Gmail through their web pages, the deleted messages are still visible in my Inbox.

Applies to: Rebex Secure Mail

1 Answer

+1 vote
answered Apr 4, 2011 by Jan Sotola (16,580 points)
edited Apr 4, 2011
 
Best answer

You have to specify on Gmail what to do with messages deleted through POP3 protocol. Log to your account on www.gmail.com and change the settings according to following instructions:

How to set Gmail account to delete messages using POP3 protocol

...