Reputation: 4271
I want to get all the messages from my gmail inbox, but I am facing 2 problems.
I am unsure if its the problem with poplib or gmail pop server.
What am I missing here?
Upvotes: 1
Views: 1428
Reputation: 33442
It's the problem of gmail: https://mail.google.com/support/bin/answer.py?answer=13291
Try to use recent:[email protected] as your email address. At least you'll have all your last month mail in correct order.
Upvotes: 0
Reputation: 15836
You can also try imaplib
module since GMail also provides access to email via IMAP protocol.
Upvotes: 2
Reputation: 113370
What does your code look like? Using poplib, you're able to decide on the order and number of the messages downloaded. The code from the poplib documentation should work:
import getpass, poplib
M = poplib.POP3('localhost')
M.user(getpass.getuser())
M.pass_(getpass.getpass())
numMessages = len(M.list()[1])
for i in range(numMessages):
for j in M.retr(i+1)[1]:
print j
Upvotes: 2