Question

When connecting to Gmail with OpenPop, I can only retrieve an email once, even if I do not delete it. Using GetMessageCount() I always receive 0 emails. How can I get all the emails that are there?

Only after reading them and processing them do I give order to delete. I am using the following code to get the emails:

using (var client = new Pop3Client())
{
    // Connect to the server
    client.Connect(serverData.Hostname, serverData.Port, serverData.UseSsl);

    // Authenticate ourselves towards the server
    client.Authenticate(serverData.Username, serverData.Password, AuthenticationMethod.UsernameAndPassword);

    var emailAmount = client.GetMessageSizes().Count;

    // Fetch all the current uids seen
    var msgCount = client.GetMessageCount();

   .....
}
Was it helpful?

Solution

Gmail is special. Take a look at this StackOverflow post which explains the non-standard behavior.

What you are interested in, is that Gmail will only show a message in ONE POP3 session, unless you do special stuff, like prepending recent: in front of your username.

OTHER TIPS

Getting only the unread mails is how POP3 is supposed to work. If you want to see and manage older mails, you should use IMAP instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top