reset POP3 flags

call RSET POP3 command to reset "seen" flag if supported by the POP3 server

darcs-hash:20060726194755-86b55-3e17c219f71aa5ca4db65f6ad8131c0222dd85b0.gz
This commit is contained in:
David Rousselie
2006-07-26 21:47:55 +02:00
parent dfb597aca3
commit 8c7fc43a4b
2 changed files with 45 additions and 4 deletions

View File

@@ -452,6 +452,10 @@ class POP3Connection(MailConnection):
def get_mail(self, index):
POP3Connection._logger.debug("Getting mail " + str(index))
ret, data, size = self.connection.retr(index)
try:
self.connection.rset()
except:
pass
if ret[0:3] == '+OK':
return self.format_message(email.message_from_string('\n'.join(data)))
return u"Error while fetching mail " + str(index)
@@ -459,6 +463,10 @@ class POP3Connection(MailConnection):
def get_mail_summary(self, index):
POP3Connection._logger.debug("Getting mail summary " + str(index))
ret, data, size = self.connection.retr(index)
try:
self.connection.rset()
except:
pass
if ret[0:3] == '+OK':
return self.format_message_summary(email.message_from_string('\n'.join(data)))
return u"Error while fetching mail " + str(index)