Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending POP3 commands to Gmail returns old messages

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 [email protected]
+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?

like image 610
nrj Avatar asked Oct 13 '22 21:10

nrj


2 Answers

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

like image 101
Pablo Rivera Avatar answered Nov 03 '22 22:11

Pablo Rivera


GMail itself will only give 300-400 messages when requested. In order to get the others, you need to supply the optional message number argument as specified in RFC1939 "Post Office Protocol - Version 3", section 5 "The TRANSACTION state", LIST command.

like image 41
Ignacio Vazquez-Abrams Avatar answered Nov 03 '22 23:11

Ignacio Vazquez-Abrams