IMAP.py Get the server response right

Now, the server response is in a list of strings. We need the second
string, so we need read the [1].

Previously, was a list of tuples, so, we used [0][1].
This commit is contained in:
Rodolfo García Peñas (kix) 2020-09-01 17:37:52 +02:00
parent ea8c0c6f3e
commit 1ff54e7a7c

View File

@ -323,10 +323,9 @@ class IMAPFolder(BaseFolder):
data = self._fetch_from_imap(str(uid), self.retrycount) data = self._fetch_from_imap(str(uid), self.retrycount)
# Data looks now e.g. # Data looks now e.g.
# [('320 (UID 17061 BODY[] {2565}','msgbody....')] # ['320 (17061 BODY[] {2565}','msgbody....']
# We only asked for one message, and that msg is in data[0]. msbody is # Is a list of two elements. Message is at [1]
# in [0][1]. data = data[1].replace(CRLF, "\n")
data = data[0][1].replace(CRLF, "\n")
if len(data) > 200: if len(data) > 200:
dbg_output = "%s...%s" % (str(data)[:150], str(data)[-50:]) dbg_output = "%s...%s" % (str(data)[:150], str(data)[-50:])