From dad65d802c7eab86c88dca3ef466dc4c43daffc0 Mon Sep 17 00:00:00 2001 From: Adam Coddington Date: Fri, 22 Aug 2014 19:27:36 -0700 Subject: [PATCH] Wrap added \Deleted flag in parentheses. Fixes #23. Apparently the IMAP specification expects that the +FLAGS argument be surrounded by parentheses; although some e-mail backends (like Gmail) will accept the +FLAGS argument without surrounding the \Deleted flag in parentheses, many (reasonably) follow the specification much more closely. This problem was first noted in report #23. Searching for other examples of mail deletion, I've found several Stack Overflow articles in which people are attempting the same task, and each either uses `imap.store` without surrounding '\Deleted' in parentheses, or uses `imap.uid` *while* surrounding '\Deleted' in parentheses: * http://stackoverflow.com/questions/1777264/using-python-imaplib-to-delete-an-email-from-gmail * http://stackoverflow.com/questions/3180891/imap-deleting-messages --- django_mailbox/transports/imap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django_mailbox/transports/imap.py b/django_mailbox/transports/imap.py index e60fd11..90435eb 100644 --- a/django_mailbox/transports/imap.py +++ b/django_mailbox/transports/imap.py @@ -96,6 +96,6 @@ class ImapTransport(EmailTransport): if self.archive: self.server.uid('copy', uid, self.archive) - self.server.uid('store', uid, "+FLAGS", "\\Deleted") + self.server.uid('store', uid, "+FLAGS", "(\\Deleted)") self.server.expunge() return