Using POP3 on gmail can't retrieve all messages

0 votes
asked Jun 20 by Seo (120 points)

I'm new with Rebex.
I'm trying to get the emails from gmail using pop3.

I wrote this code:

var pop3 = new Rebex.Net.Pop3();
pop3.Settings.SslAcceptAllCertificates = true;
pop3.Connect(hostname, SslMode.Implicit);
pop3.Login(username, password);
Pop3MessageCollection emailHeaders = pop3.GetMessageList(Pop3ListFields.FullHeaders);

In the gmail inbox there are 7 emails.
When I had 5 emails I opened Thunderbird and got all messages.
After that I received other 2 emails.
If I use the code above now I receive just the last 2 emails.

How can I receive all 7 emails using pop3?

Thank you.

Applies to: Rebex Secure Mail

1 Answer

0 votes
answered Jun 20 by Lukas Matyska (47,270 points)
edited Jun 21 by Lukas Matyska

UPDATE:

The log showed, that the server returned only two messages, which is behavior of the server and client cannot change this.

Probable cause is configuration of the POP3 access on Gmail; or some kind of Gmail optimization when using another client before (Thunderbird).

The suggested solution is to use IMAP protocol; or use only one POP3 client to access Gmail.


Can you please create VERBOSE communication log and share it here or send it to use (support@rebex.net) for analysis.
It can be created like this:

var pop3 = new Rebex.Net.Pop3();
pop3.Connect(hostname, SslMode.Implicit);
pop3.Login(username, password);

pop3.LogWriter = new Rebex.FileLogWriter(@"c:\data\pop3.log", LogLevel.Verbose);

Pop3MessageCollection emailHeaders = pop3.GetMessageList(Pop3ListFields.FullHeaders);

Assign logger after Login() call to prevent exposing sensitive data in log.

...