From 7da50e638d45bcea1d456c6fadbe2a17934660df Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Thu, 16 Feb 2012 16:49:06 +0100 Subject: [PATCH] folder/IMAP: better error when savemessage fails If we cannot identify the new UID after a sendmessage(), log a better error message, including the server response for better debugging. Signed-off-by: Sebastian Spaeth --- offlineimap/folder/IMAP.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py index d06c740..8b46996 100644 --- a/offlineimap/folder/IMAP.py +++ b/offlineimap/folder/IMAP.py @@ -577,7 +577,10 @@ class IMAPFolder(BaseFolder): "appending a message.") else: uid = long(resp[-1].split(' ')[1]) - + if uid == 0: + self.ui.warn("savemessage: Server supports UIDPLUS, but" + " we got no usable uid back. APPENDUID reponse was " + "'%s'" % str(resp)) else: # Don't support UIDPLUS # Checkpoint. Let it write out stuff, etc. Eg searches for @@ -593,9 +596,11 @@ class IMAPFolder(BaseFolder): # compare the message size... if uid == 0: self.ui.debug('imap', 'savemessage: attempt to get new UID ' - 'UID failed. Search headers manually.') + 'UID failed. Search headers manually.') uid = self.savemessage_fetchheaders(imapobj, headername, headervalue) + self.ui.warn('imap', "savemessage: Searching mails for new " + "Message-ID failed. Could not determine new UID.") finally: self.imapserver.releaseconnection(imapobj)