Помогите пожалуйста, не понимаю в чем проблема
def read(username, password, from_addr):
# Login to INBOX
imap = imaplib.IMAP4_SSL("imap.mail.ru", 993)
imap.login(username, password)
imap.select('INBOX')
# Use search(), not status()
status, response = imap.search('INBOX', '(UNSEEN)')
unread_msg_nums = response[0].split()
# Print the count of all unread messages
print(len(unread_msg_nums))
# Print all unread messages from a certain sender of interest
status, response = imap.search(None, '(UNSEEN)',
'(FROM "{}")'.format(from_addr))
unread_msg_nums = response[0].split()
da = []
for e_id in unread_msg_nums:
_, response = imap.fetch(e_id, '(UID BODY[TEXT])')
da.append(response[0][1])
print(da)
Traceback (most recent call last):
File "/home/user/temp.py", line 31, in <module>
read('my_login', ",my_passwd", 'text')
File "/home/user/temp.py", line 23, in read
_, response = imap.fetch(e_id, '(UID BODY[TEXT])')
File "/usr/lib/python3.4/imaplib.py", line 474, in fetch
typ, dat = self._simple_command(name, message_set, message_parts)
File "/usr/lib/python3.4/imaplib.py", line 1134, in _simple_command
return self._command_complete(name, self._command(name, *args))
File "/usr/lib/python3.4/imaplib.py", line 965, in _command_complete
raise self.error('%s command error: %s %s' % (name, typ, data))
imaplib.error: FETCH command error: BAD [b'[PARSE] Range parse error']