Sending POP3 commands to Gmail returns old messages

command linegmailpop3telnet

I am trying to issue simple POP3 commands to Gmail like so:

openssl s_client -connect pop.gmail.com:995
+OK Gpop ready for requests from XX.XX.XX.XX
USER my-email@gmail.com
+OK send PASS
PASS mypassword
+OK Welcome.

Connection and authentication all works fine. However when I issue a STAT or LIST command I receive the following:

STAT
+OK 345 20351669

This states I have 345 messages in my Inbox. In actuality I have 180, only a few unread. This number couldn't be refering to ALL of my emails… I've had this account for 5 years and definitely have WAY more than 345. So, I started RETR'ing some messages. The newest one (#345) is from Jan 2007 and the oldest one (#1) is from late 2006. Over the course of writing this I've received a few new emails, but even after reconnecting and issuing new LIST commands the 345 number does not change.

I'm no e-mail/pop expert but I'm really stumped here… POP3 is enabled for "all messages" in gmail settings. I even tried doing this same thing with another Gmail account and I get the exact same results; a really low message count and really old messages.

Any ideas?

Best Answer

try

USER recent:my-email

instead of

USER my-email

Seems like the "recent:" prefix on the username re-fetches the most recent messages:

How to re-download recent Gmail messages