From 84efb452701d26b9870251fdeb959c895103ed86 Mon Sep 17 00:00:00 2001 From: Chris Coleman Date: Thu, 6 Feb 2020 12:32:28 -0500 Subject: [PATCH] Handle [ALREADYEXISTS] and Mailbox already exists! Make compatible with IMAP servers that give the reason code "[ALREADYEXISTS]" and IMAP servers that give natural language reason "Mailbox already exists!" by searching for the two words "already" and "exists" in the exception reason string. Signed-off-by: Nicolas Sebrecht --- offlineimap/repository/IMAP.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/offlineimap/repository/IMAP.py b/offlineimap/repository/IMAP.py index 1f5c855..700d4f2 100644 --- a/offlineimap/repository/IMAP.py +++ b/offlineimap/repository/IMAP.py @@ -561,7 +561,8 @@ class IMAPRepository(BaseRepository): try: self.makefolder_single(folder_path) except OfflineImapError as e: - if '[ALREADYEXISTS]' not in e.reason: + reasonLower = e.reason.lower() # Handle reasons '[ALREADYEXISTS]' and 'Mailbox already exists!' @chris001 + if not ('already' in reasonLower and 'exists' in reasonLower): raise def makefolder_single(self, foldername):