473,226 Members | 1,660 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,226 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 6036
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Rybread | last post by:
Real quick, I have account X and I want a python script that goes in and looks for emails sent from Y and then to save them. i'm trying to go off the swen killer I have listed below (which i took...
2
by: brettk | last post by:
Hello All, Here's what I'm trying to do: I need to connect to a pop3 server, download all messages, and copy all of the attachments into a specific directory. The actual email message is...
2
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...
0
by: Frank Churchill | last post by:
Has anyone used poplib and popfile together? I've tried everything I can think of to specify SRVR in poplib: "127.0.0.1:8081" "127.0.0.1,port=8081" "localhost:8081" "localhost,port=8081" ...
1
by: LJ | last post by:
Hello, I'm trying to monitor my gmail account to know when I have obtained a new email. It seems that once I have logged in, I should be able to call the stat() function repeatedly to see how...
4
by: SuperHik | last post by:
Hi! I want to connect to gmail but... It requires SSL so I worte: Traceback (most recent call last): File "<interactive input>", line 1, in ? File "C:\Python24\lib\poplib.py", line 359, in...
4
by: Jean-Claude Neveu | last post by:
Hello, I am writing a Python program to check email using POP3. I've tried the sample code from python.org, and it works great. In other words, the code below successfully prints out my emails....
2
by: Roopesh | last post by:
Hi, I am using poplib's retr() to fetch mails from my gmail account. It works fine, in some cases it gets stuck inside the retr() method and does not come out. From the logs I could find that...
2
by: SteveC | last post by:
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...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.