473,569 Members | 3,040 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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('ma il.server.com')
pop.user('e**** @server.com')
pop.pass_('pass word')
status, msg_list, octets = pop.list()

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

if not msg.is_multipar t() and msg.get_content _type() == 'text/plain':
print msg.get('Subjec t')
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 6082
En Tue, 19 Jun 2007 05:14:58 -0300, EuGeNe Van den Bulke
<eu************ ****@gmail.come scribió:
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.come scribió:
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
3018
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 from someone on this NG): import poplib import time print 'Start at', time.asctime()
2
6698
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 unimportant. Now, I've found plenty of examples that strip the attachments from an email message, but most (if not all) of them take a file parameter....
2
2686
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 2.3.5 (#2, May 4 2005, 08:51:39) on linux2
0
1217
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" and probably a few other things, but poplib can't see
1
8145
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 many messages are in my inbox. The problem is that this number does not seem to update until I have logged out, and logged back in. In other words,...
4
2186
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 __init__ self.sslobj = socket.ssl(self.sock, self.keyfile, self.certfile) AttributeError: 'module' object has no attribute 'ssl'
4
4752
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. import getpass, poplib, email M = poplib.POP3('mail.blah.com') M.user('username') M.pass_('password')
2
2641
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 when retr() is called, it stops executing further statements, nor does it throw an exceptions but simply stops. My code is roughly like the foll:
2
3014
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 import getpass, poplib M = poplib.POP3('localhost') M.user(getpass.getuser())
0
7930
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8138
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7681
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6290
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3662
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2118
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 we have to send another system
0
950
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.