Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions django_mailbox/transports/imap.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,14 @@ def _get_small_message_ids(self, message_ids):
for each_msg in data:
each_msg = each_msg.decode()
try:
uid = each_msg.split(' ')[2]
size = each_msg.split(' ')[4].rstrip(')')
stripped_msg = each_msg.replace('(', '').replace(')', '')
split_msg = stripped_msg.split(' ')
for i, s in enumerate(split_msg):
if s == 'UID':
uid = split_msg[i + 1]
elif s == 'RFC822.SIZE':
size = split_msg[i + 1]

if int(size) <= int(self.max_message_size):
safe_message_ids.append(uid)
except ValueError as e:
Expand Down