473,498 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

POP3 - Using poplib only shows the first few hundred messages in themailbox

Hello,

I am trying to use POP3_SSL class of the poplib module to read email
from my gmail account. I can connect just fine using the example here
http://www.python.org/doc/lib/pop3-example.html

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
That is the above sample code from the python doc. While everything
works fine, the problem is that when I use the list() function it only
returns about 400 messages starting from the beginning of my inbox. I
have probably 10,000 emails in my gmail account. I don't see any pop3
object functions to "move" around the inbox or anything of the like.

Could someone point me in the right direction? I'm sure there must be
something simple I am missing.

Thanks,
Steve
Jul 25 '08 #1
2 2995
On Jul 25, 1:18*pm, SteveC <sbc...@gmail.comwrote:
Hello,

I am trying to use POP3_SSL class of the poplib module to read email
from my gmail account. *I can connect just fine using the example herehttp://www.python.org/doc/lib/pop3-example.html

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

That is the above sample code from the python doc. *While everything
works fine, the problem is that when I use the list() function it only
returns about 400 messages starting from the beginning of my inbox. *I
have probably 10,000 emails in my gmail account. *I don't see any pop3
object functions to "move" around the inbox or anything of the like.

Could someone point me in the right direction? *I'm sure there must be
something simple I am missing.
That's a lot of emails! :-)

I had a quick look at poplib.py and I couldn't see any limit in the
code itself. Perhaps it's the gmail server that's doing it. Can you
retrieve the later messages, eg have you tried M.retr(500)? If you can
then you could just try retrieving messages beyond what M.list() says
until it says there's no such message.
Jul 25 '08 #2
On Jul 25, 6:07*pm, MRAB <goo...@mrabarnett.plus.comwrote:
On Jul 25, 1:18*pm, SteveC <sbc...@gmail.comwrote:
Hello,
I am trying to use POP3_SSL class of thepoplibmodule to read email
from my gmail account. *I can connect just fine using the example herehttp://www.python.org/doc/lib/pop3-example.html
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
That is the above sample code from the python doc. *While everything
works fine, the problem is that when I use the list() function it only
returns about 400 messages starting from the beginning of my inbox. *I
have probably 10,000 emails in my gmail account. *I don't see any pop3
object functions to "move" around the inbox or anything of the like.
Could someone point me in the right direction? *I'm sure there must be
something simple I am missing.

That's a lot of emails! :-)

I had a quick look atpoplib.py and I couldn't see any limit in the
code itself. Perhaps it's the gmail server that's doing it. Can you
retrieve the later messages, eg have you tried M.retr(500)? If you can
then you could just try retrieving messages beyond what M.list() says
until it says there's no such message.
Nothing changes when I retrieve the messages it first provides me.
What baffles me is I see tons of examples online doing the same thing:
http://python.about.com/od/simplersc...up_gmail_3.htm

I'm not sure if it could be just a gmail thing either, because then it
would seem that this would be a problem with any pop email client.
Jul 30 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2457
by: Robin Becker | last post by:
Hi, I'm getting vast numbers of fake upgrade emails containing some kind of virus. My rather old client can be made to reject these based on some patterns in the subject line. They're nearly all...
1
2693
by: p-nut | last post by:
newbie here needing some help. Is there a way to set up a script that will check a pop3 account and autosave the file attachments to a folder specified? The thing is: I have 1 single email...
4
3718
by: Paul Schmidt | last post by:
Dear list: I am new to python, and I am trying to figure out the short answer on something. I want to open a POP3 mailbox, read the enclosed mail using the POP3 module, , and then process it...
2
2680
by: Steve Greenland | last post by:
For the poplib.POP3 object, docs say: list() Request message list, result is in the form (response, ). If which is set, it is the message to list. But (I've folded the long line): Python...
1
1728
by: Kevin F | last post by:
Having some troubles downloading messages with POP3... I can connect to the server just fine and list messages without any problem with the following code: ------------------------ from...
8
1630
by: Kevin F | last post by:
Having some troubles downloading messages with POP3... I can connect to the server just fine and list messages without any problem with the following code: ------------------------ from...
1
2239
by: Kevin F | last post by:
I have the following script: emails = for msg in messagesInfo: msgNum = int(msg.split()) msgSize = int(msg.split()) if(msgSize < 20000): message = server.retr(msgNum) Message =...
1
10044
by: bobano | last post by:
Hi everyone, I am writing a POP3 Client program in Perl. You connect to a POP3 Server and have a running conversation with the mail server using commands from the RFC 1939 Post Office Protocol....
9
9237
by: flit | last post by:
Hello All, Using poplib in python I can extract only the headers using the .top, there is a way to extract only the message text without the headers? like remove the fields below: "...
0
7126
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7005
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7168
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7210
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5465
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4595
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3096
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1424
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
293
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.