471,342 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,342 software developers and data experts.

poplib.retr doens't flag message as read

Hi there,

I am trying to use the poplib library to get emails using the retr
method. The small program bellow works but the message aren't flagged as
read which puzzles me. I believe the pop server is qmail 1.0.6 /
vpopmail 5.2.1 and I am running the following script on Windows using
Pyhton 2.5.

import poplib
import email

pop = poplib.POP3('mail.server.com')
pop.user('e****@server.com')
pop.pass_('password')
status, msg_list, octets = pop.list()

for msg_number in [msg.split(' ')[0] for msg in msg_list]:
status, lines, octets = pop.retr(msg_number)
msg = email.message_from_string('\n'.join(lines))

if not msg.is_multipart() and msg.get_content_type() == 'text/plain':
print msg.get('Subject')
print msg.get_payload()

pop.quit()

Why aren't the message flagged as read? Is there a way to manually mark
them read?

Thanks,

EuGeNe -- http://www.3kwa.com
Jun 19 '07 #1
3 5807
En Tue, 19 Jun 2007 05:14:58 -0300, EuGeNe Van den Bulke
<eu****************@gmail.comescribió:
I am trying to use the poplib library to get emails using the retr
method. The small program bellow works but the message aren't flagged as
read which puzzles me. I believe the pop server is qmail 1.0.6 /
vpopmail 5.2.1 and I am running the following script on Windows using
Pyhton 2.5.
The POP protocol has no concept of "read" or "unread" messages; the LIST
command simply shows all existing messages. You may want to use another
protocol, like IMAP, if the server supports it.

You could delete messages after successful retrieval, using the DELE
command. Only after a successful QUIT command will the server actually
delete them.

--
Gabriel Genellina

Jun 20 '07 #2
Gabriel Genellina wrote:
The POP protocol has no concept of "read" or "unread" messages; the LIST
command simply shows all existing messages.
My mistake, I guess I was confused by the documentation

retr( which) Retrieve whole message number which, and set its seen flag.
Result is in form (response, ['line', ...], octets).

What is the seen flag? Nothing it seems
http://mail.python.org/pipermail/pyt...ly/329888.html

Thanks for your help,

EuGeNe -- http://www.3kwa.com
Jun 20 '07 #3
En Wed, 20 Jun 2007 06:42:15 -0300, EuGeNe Van den Bulke
<eu****************@gmail.comescribió:
Gabriel Genellina wrote:
>The POP protocol has no concept of "read" or "unread" messages; the LIST
command simply shows all existing messages.

My mistake, I guess I was confused by the documentation

retr( which) Retrieve whole message number which, and set its seen flag.
Result is in form (response, ['line', ...], octets).

What is the seen flag? Nothing it seems
http://mail.python.org/pipermail/pyt...ly/329888.html
Yes, sure, the docs are misleading. I'd just remove the reference to the
"seen flag".

--
Gabriel Genellina

Jun 20 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Steve Greenland | last post: by
reply views Thread by Frank Churchill | last post: by
1 post views Thread by LJ | last post: by
4 posts views Thread by SuperHik | last post: by
4 posts views Thread by Jean-Claude Neveu | last post: by
2 posts views Thread by Roopesh | last post: by
reply views Thread by rosydwin | last post: by

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.