diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py index 6ff73ec..9f60ded 100644 --- a/offlineimap/folder/IMAP.py +++ b/offlineimap/folder/IMAP.py @@ -562,7 +562,7 @@ class IMAPFolder(BaseFolder): def deletemessages_noconvert(self, uidlist): # Weed out ones not in self.messagelist - uidlist = [uid for uid in uidlist if uid in self.messagelist] + uidlist = [uid for uid in uidlist if self.uidexists(uid)] if not len(uidlist): return diff --git a/offlineimap/folder/Maildir.py b/offlineimap/folder/Maildir.py index 02e64d2..e360619 100644 --- a/offlineimap/folder/Maildir.py +++ b/offlineimap/folder/Maildir.py @@ -295,8 +295,16 @@ class MaildirFolder(BaseFolder): assert final_dir != tmpdir def deletemessage(self, uid): - if not uid in self.messagelist: + """Unlinks a message file from the Maildir. + + :param uid: UID of a mail message + :type uid: String + :return: Nothing, or an Exception if UID but no corresponding file + found. + """ + if not self.uidexists(uid): return + filename = self.messagelist[uid]['filename'] try: os.unlink(filename)