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

Timothy Grant timothy.grant at gmail.com
Fri Jul 25 18:29:56 CEST 2008

On Fri, Jul 25, 2008 at 5:18 AM, SteveC <sbcook at gmail.com> wrote:

> 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
> --
> http://mail.python.org/mailman/listinfo/python-list

The GroupWise popper where I work only allows access to the first  100
messages. To access the next 100 you have to retrieve the first 100.

My guess is that gmail is doing something similar.

If you retrieve the first 400, do you get a new list the next time?

Stand Fast,
tjg. [Timothy Grant]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080725/7d277d85/attachment.html>

More information about the Python-list mailing list