Hello,
I've verified that both Rebex POP3 and MailBee POP3 components behave the same.
When the entire message is downloaded, it won't appear in the message list the next time.
That occurs when using e.g. Rebex GetMailMessage
method (or MailBee DownloadEntireMessage
method).
Simply:
- when you retrieve just the message headers from Gmail using POP3, messages are provided again each time you retrieve the message list
- when you retrieve a message using the
GetMailMessage
method, the message is marked in Gmail internally as "already received by POP3" and it is not accessible by POP3 connection any more (until the received flag is reset through web settings page).
NOTE: the behavior described only applies if the POP3 session is properly disconnected (by calling Disconnect
method on the POP3 instance - calling the Dispose
method only is not enough).
Here are two samples (using Rebex and MailBee components) that do the same. Both are retrieving the POP3 messages just one time.
Sample using Rebex Pop3 component:
Pop3 client = new Pop3();
client.Connect("pop.gmail.com", Pop3.DefaultImplicitSslPort, null, Pop3Security.Implicit);
client.Login("username", "password");
Pop3MessageCollection messages = client.GetMessageList(Pop3ListFields.FullHeaders);
foreach (Pop3MessageInfo msg in messages)
{
// IF THE FOLLOWING LINE IS USED, THE MESSAGE WON'T APPEAR WHEN GETTING THE LIST NEXT TIME
// (equivalent to MailBee Pop3.DownloadEntireMessage method)
MailMessage fullMsg = client.GetMailMessage(msg.SequenceNumber);
Console.WriteLine("From: " + msg.From + ", To: " + msg.To + ", Subject: " + msg.Subject);
}
client.Disconnect();
Sample using MailBee Pop3 component:
Pop3 pop = new Pop3();
pop.Connect("pop.gmail.com", 995);
pop.SslMode = MailBee.Security.SslStartupMode.OnConnect;
pop.Login("username", "password");
MailMessageCollection msgs = pop.DownloadMessageHeaders();
foreach (MailMessage msg in msgs)
{
// IF THE FOLLOWING LINE IS USED, THE MESSAGE WON'T APPEAR WHEN GETTING THE LIST NEXT TIME
// (equivalent to Rebex Pop3.GetMailMessage method)
MailMessage fullMsg = pop.DownloadEntireMessage(msg.IndexOnServer);
Console.WriteLine("From: " + msg.From.Email + ", To: " + msg.To.AsString + ", Subject: " + msg.Subject);
}
pop.Disconnect();
NOTE: The behavior mentioned in this post is specific for the Gmail POP3 communication. Other POP3 server would behave another way.