Running the script for the 2-nd time, the messages are not retrieved from the mail server

Posted by Max Li on Stack Overflow See other posts from Stack Overflow or by Max Li
Published on 2012-10-19T22:38:49Z Indexed on 2012/10/20 17:01 UTC
Read the original article Hit count: 116

Filed under:
|

I read the mails from my gmail account with the code following below.

import poplib
pop_conn = poplib.POP3_SSL('pop.gmail.com')
pop_conn.user('user')             # result: '+OK send PASS'
pop_conn.pass_('password')        # result: '+OK Welcome.'
print pop_conn.list()[1]
pop_conn.quit()

It shows me 1 message as expected.
However, if I run this script for the second time, I get 0 messages as result. On the server the message is still there and unread.
How can I get all the messages also running the script for the second time?

For me it behaves as an email client that doesn't download the same mail twice. Is there some flag to force the program to download everything again? I use python 2.7.x on ubuntu 12.10

© Stack Overflow or respective owner

Related posts about python

Related posts about pop3