diff --git a/offlineimap/repository/IMAP.py b/offlineimap/repository/IMAP.py index c86f129..6e0cdc4 100644 --- a/offlineimap/repository/IMAP.py +++ b/offlineimap/repository/IMAP.py @@ -772,6 +772,10 @@ class IMAPRepository(BaseRepository): def deletefolder(self, foldername): """Delete a folder on the IMAP server.""" + # Folder names with spaces requires quotes + if ' ' in foldername: + foldername = '"' + foldername + '"' + if self.account.utf_8_support: foldername = imaputil.utf8_IMAP(foldername) imapobj = self.imapserver.acquireconnection() @@ -833,6 +837,10 @@ class IMAPRepository(BaseRepository): return imapobj = self.imapserver.acquireconnection() try: + # Folder names with spaces requires quotes + if ' ' in foldername: + foldername = '"' + foldername + '"' + if self.account.utf_8_support: foldername = imaputil.utf8_IMAP(foldername)