How to read email and do not mark it as READ...?
Anders Eriksson
amez at swipnet.se
Sat Sep 15 07:37:45 EDT 2001
On 15 Sep 2001 00:06:28 -0700, jriveramerla at yahoo.com (Jose Rivera)
wrote:
>Hi...
> I want to make a script that fetch the email to my HardDisk...
>pop.py and imap.py works ok, but they leave the message marked as READ
>and I don't want that...
> I know PowerBuilder can do it, so there must be a way in Python...
>
Using POP you have to
issue the 'command' RSET just before QUIT. See RFC 1725
e.g.
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
# reset read flag
M.rset()
#close connection
M.quit()
// Anders
More information about the Python-list
mailing list